試圖從PHP試圖從PHP
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Find status for row with Username of the Url?username=
$sql = "SELECT Status FROM Users WHERE Username = '".$_GET["username"]."'";
$result = mysql_query($sql) or die('Error connecting to database');
$username = mysql_result($result, 0, "Status");
echo 'Username Status is ' . $Status;
mysqli_close($conn);
?>
在結果我得到讀取我的MySQL數據庫中的用戶的狀態讀取我的MySQL DATABSE用戶的狀態是這樣的:
Fatal error: Uncaught Error: Call to undefined function mysql_query() in /storage/ssd4/269/2113269/public_html/teststat.php:11 Stack trace: #0 {main} thrown in /storage/ssd4/269/2113269/public_html/teststat.php on line 11
完美謝謝!這是因爲在試圖使這個腳本更好地工作時,我從一箇舊網站(它使用mysql)複製。 –
@Luke Deven,很高興它適合你。 :) –