我试图只选择我正在构建的社交网络中的特定数据。登录会话是$SESSION['user_login']
,它似乎没有选择我需要的行。有人有什么想法吗?
<?php
if (isset($_GET['u'])) {
$username = mysql_real_escape_string($_GET['u']);
if (ctype_alnum($username)) {
//check user exists
$check = mysql_query("SELECT username, first_name FROM users WHERE username='$username'");
if (mysql_num_rows($check)===1) {
$get = mysql_fetch_assoc($check);
$username = $get['username'];
$firstname = $get['first_name'];
}else{
echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";
exit();
}
}
}