PHP和SQL没有正确返回

PHP和SQL没有正确返回,php,sql,Php,Sql,我试图从SQL数据库中提取一个三个字符的字符串并将其存储为会话,但它无法正常工作 这里是我请求SQL查询并设置会话的地方 $verified_query = mysql_query("SELECT verified FROM `members` WHERE username = '$myusername'"); $verified = mysql_result($verified_query, 0); // 0 is the index of the field, not the row //

我试图从SQL数据库中提取一个三个字符的字符串并将其存储为会话,但它无法正常工作

这里是我请求SQL查询并设置会话的地方

$verified_query = mysql_query("SELECT verified FROM `members` WHERE username = '$myusername'");
$verified = mysql_result($verified_query, 0); // 0 is the index of the field, not the row

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);

// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){

// Register $myusername, $mypassword and redirect to file "login_success.php"
$_SESSION["myusername"] = $myusername;
$_SESSION["mypassword"] = $mypassword;
$_SESSION["verified"] = $verified;
header("location:index.php");
}
else {
echo "Wrong Username or Password";
}
?>
下面是我尝试获得课程的地方:

    <?php
session_start();
if(!$_SESSION["myusername"]){
include("./assets/inc/nli-home.inc.php");
}
else {
include("./assets/inc/connect.inc.php"); 
include("./assets/inc/header.inc.php");
if ($_SESSION["verified"] == "no") {
include("./assets/inc/settings.inc.php"); 
}
else {
}
if ($_SESSION["verified"] == "yes") {
    include("./assets/inc/settings-admin.inc.php"); 
}
else {}

include("./assets/inc/header2.inc.php"); 
include("./assets/inc/footer.inc.php");
}
?>
<script>console.log("<?php echo $_SESSION['verified'] ?>");</script>

控制台日志(“”);
$verified=mysql\u结果($verified\u查询,0);//0是字段的索引,而不是行的索引
//Mysql\u num\u行是计数表行

$count=mysql\u num\u行($verified);它失败在哪里?它为每个用户返回“是”,而不是为某些用户返回“否”。-未定义的变量结果通知。
$verified = mysql_result($verified_query, 0); // 0 is the index of the field, not the row

// Mysql_num_row is counting table row
$count=mysql_num_rows($verified); <- Error was here