我大家,香港專業教育學院編寫了一個腳本,最近似乎也不錯,但是當我去我的網頁上在本地主機上,香港專業教育學院這樣的錯誤:檢查我的index.php請
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /srv/http/index.php:11 Stack trace: #0 {main} thrown in /srv/http/index.php on line 11
<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
$db_hostname = '127.0.0.1';
$db_username = 'root';
$db_password = 'mypass';
$db_database = 'my database name';
$connect = mysql_connect("$db_hostname","$db_username","$db_password");
if (!$connect)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($db_database) or die ("could not find db");
$output ='';
if (isset ($_POST['search'])){
$search = $_POST['search'];
}
$query = mysql_query("SELECT * FROM user WHERE email LIKE '%".$search."%'") or die("could not search");
$count = mysql_num_rows($query);
if($count == 0){
$output = 'There was no search results !';
}
else{
while($row = mysql_fetch_array($query)){
$fname = $row['search];
$output .='<div> '.$fname.'</div>';
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8" />
<title>Lookup</title>
</head>
<body>
<form action="index.php" method="post">
<input type="text" placeholder="search" name="search">
<input type="submit" value=">>"/>
</form>
<?php
print("$output");
?>
</body>
</html>
And this is what the page return
和錯誤是????????????????? – rtfm
..除了使用mysql_編寫新代碼_ * – rtfm
*一個錯誤*是一個絕對無用的問題描述。當你收到錯誤信息時,會出現一條錯誤信息。它正好在你面前的屏幕上。有**零**的理由,你不要把它包括在你的問題在這裏。你問我們**免費幫助**解決**你的問題**。您應該儘可能方便地爲我們提供相關信息,這些信息在您面前**。 –