简体   繁体   中英

php Code Prints out in screen instead of executing?

It worked exactly fine few hours back, but now its showing the code in the browser instead of executing it. Rechecked the code thrice, checked with the file extension, even retyped the whole code into a new php, this bug is haunting me..

My code goes like this:

<?php include('usersign.php'); ?>

<?php

$servername  = "localhost";
$dbusername = "root";
$dbpassword = "******";
$dbname = "userdatabase";

$username = $_POST['username'];
$email = $_POST['email'];
$category1 = $_POST['category1'];
$category2 = $_POST['category2'];
$category3 = $_POST['category3'];
$password = $_POST['password'];
$date = date_default_timezone_set('Asia/Kolkata');
$date = date('M-d,Y H:i:s');


$conn = new mysqli ($servername, $dbusername, $dbpassword, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}


$sql = "INSERT INTO user (username, email, category1, category2, category3, password, date)
VALUES ('$username', '$email', '$category1', '$category2', '$category3', '$password', '$date')";
if ($conn->query($sql) === TRUE) {
echo '<script language="javascript">';
echo 'alert("You have succesfully registerd with userdatabase Please login..")';
echo '</script>';
echo '<a href="usersign.php"></a>';
}
else {
    echo "ERROR" . $sql . "<br>" . $conn->error;
}

$conn->close();
?>

Any suggestions are Appreciated...

尝试重新启动您的网络服务器,因为您说它刚刚工作...如果它仍然无法工作,请检查您的网络服务器日志中的错误,您很可能会获得更多实际发生的信息。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM