0

In the below code inside print i have $ fullname and $email

I don't know why its not retriving from database

can any one help me:

<?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.";
      ?>
5
  • 3
    $email is not defined anywhere? Commented Feb 19, 2014 at 12:10
  • 1
    What's the value of $userid. Is there any rows for that id? Commented Feb 19, 2014 at 12:10
  • @Shamil $fullname is defined why fullname is not displaying Commented Feb 19, 2014 at 12:11
  • 1
    if you echo your query. what you get ? if query does not fetch records than while loop will not run, therefore $fullname and $email will not be populated Commented Feb 19, 2014 at 12:15
  • an out of loop suggestion....DO NOT USE mysql_ any more....its insecure, go for mysqli_ or PDO... Commented Feb 19, 2014 at 12:29

1 Answer 1

1

can you try:

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

Also:

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

If you get 0 from num rows, your SQL is most likely at fault. If you get a number and only the print does not work, check if there actually is a value in $fullname.

I recommend that you rewrite your code to use Mysqli with prepared statements.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.