2014-02-19 42 views
0

retriving数据在下面的代码里面打印我有$全名和$电子邮件PHP和MySQL:数据库内不打印

我不知道为什么它不从数据库

retriving

任何一个可以帮帮我:

<?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."; 
     ?> 
+3

'$ email'没有在任何地方定义? – bear

+1

'$ userid'的价值是什么。那个ID有没有行? –

+0

@Shamil $ fullname被定义为什么fullname不显示 – user3304633

回答

1

你可以试试:

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

另外:

echo mysql_num_rows($result); // should tell you the number of rows 

如果你从NUM行得到0,你的SQL是最有可能出现故障。 如果您收到一个号码并且只有打印不起作用,请检查$全名是否存在实际值。

我建议您重写代码以使用Mysqli和预准备语句。