php和mysql:数据库未检索打印内部的数据

php和mysql:数据库未检索打印内部的数据,php,mysql,Php,Mysql,在下面的代码内部打印中,我有$fullname和$email 我不知道为什么它不能从数据库中检索 有人能帮我吗 <?php //Connect to the database through our include include_once "database.php"; // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM jobseeker_m

在下面的代码内部打印中,我有$fullname和$email

我不知道为什么它不能从数据库中检索

有人能帮我吗

<?php
//Connect to the database through our include 
include_once "database.php";
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * FROM jobseeker_members WHERE id='$userid'"); 
while($row = mysql_fetch_array($sql)){
$fullname = $row["fullname"];
$country = $row["country"];
$state = $row["state"];
$city = $row["city"];
$dob = $row["dob"];
$contact=$row["contact"];
$qualific=$row["qualification"];
$job1=$row["jobint1"];
$job2=$row["jobint2"];
$job3=$row["jobint3"];  
}

      print"
       <br /><br /><br /><h4>OK $fullname, one last step to verify your email identity:</h4><br />
        We just sent an Activation link to: $email<br /><br />
      <h2>Last Step to verify your email identity :</h2><br /><br />
        <strong><font color=\"#990000\">Please check your email inbox in a moment</font></strong> to click on the Activation <br />
        Link inside the message. After email activation you can log in.";
      ?>
你能试试吗:

var_dump($result); //should tell you if the result contains anything (and if so, what)
此外:

如果从num行中得到0,则SQL很可能出错。 如果您得到一个数字,但只有打印不起作用,请检查$fullname中是否确实有值


我建议您重新编写代码,以便在准备好的语句中使用Mysqli。

$email
没有在任何地方定义?
$userid
的值是什么。该id是否有行?@Shamil$fullname定义了如果您回显查询,为什么不显示fullname。你得到了什么?如果查询没有获取记录,而循环将不会运行,因此$fullname和$email将不会被填充为循环外建议….不要再使用
mysql\uu
…它不安全,请选择
mysqli\u
PDO
。。。
echo mysql_num_rows($result); // should tell you the number of rows