无论如何,我无法弄清楚我的代码中出现此错误的原因:
mysql_fetch_assoc():提供的参数不是有效的 MySQL 结果资源
这是我的PHP代码:
<?php
$session_id = $_SESSION['id'];
$getall = mysql_query("SELECT * FROM users WHERE id='' . $dbuser_id . ''");
$row = mysql_fetch_assoc($getall);
$fullnameDB = $row['name'];
$emailDB = $row['email'];
$usernameDB = $row['username'];
$fullname = strip_tags($_POST['fullname']);
$username = strip_tags($_POST['username']);
$email = strip_tags($_POST['email']);
if ($_POST['submit']) {
$namecheck = mysql_query("SELECT username FROM users WHERE username='' . $username . ''");
$count = mysql_num_rows($namecheck);
if ($count !=0) {
echo 'That username is already taken!';
} else {
mysql_query("UPDATE users SET username=' . $username . ' WHERE id='' . $dbuser_id . ''");
echo 'Your UN has been updated';
}
}
?>