Jump to content

Recommended Posts

Hello,

 

I am trying to get the number of rows being retrieved to equal to 1 after running this query :

 

if ($e && $p) { //this condition passed the test

$query = "SELECT user_id , first_name FROM customer WHERE (email='$e' AND pass = SHA('$p')) AND active IS NULL";

 

$result = mysql_query ($query) or trigger_error("Query: $query\n <br />MySQL Error: " . mysql_error());

$num_rows =mysql_num_rows($result);

echo"the num of rows = $num_rows<br>";  }

 

>:( here's where I keep getting a 0, I know that all my variables are correct, and for some reason it's never changing.

I need to pass that so I can :

if($num_rows ==1)

{

$row = mysql_fetch_array($result,MYSQL_NUM);

mysql_free_result($result);

mysql_close();

$_SESSION['first_name']=$row[1];

echo "{$_SESSION['first_name']} <br>"; // it's not getting here, I need to get that for my login session.

 

}

 

 

Please help!

 

Link to comment
https://forums.phpfreaks.com/topic/115960-mysql-query-ampamp-php/
Share on other sites

It Worked! The problem was with the NULL, I had it sat up by default to "Not Null" and when I used to see the cell empty, I used to think that it's null, but actually the space does not mean null.

Thank you very much for your help! huesped214 & Crayon Violent  Thank you!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.