-2
如何使用上一頁發送的GET變量恢復數據庫行?使用GET變量恢復數據庫數據
我已經試過這樣:
$username = $_GET["username"];
$result = mysqli_query($con,"SELECT * FROM users
WHERE username=$username");
,但它給我的錯誤
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /homepages/12/d441172468/htdocs/cmd/play/index.php on line 33
請幫幫忙!謝謝!
假設'$ username'是一個字符串,則必須使用引號'其中username =「$用戶名」 '。但是這很容易受SQL注入的影響。至少,你必須調用'$ username = mysqli_real_escape_string($ con,$ username);' – 2013-03-06 03:11:21