Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return number of rows 1

Status
Not open for further replies.

hovercraft

Technical User
Jun 19, 2006
236
US
Greetings,

I am getting an error: "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/teelogic/public_html/new_acct.php on line 34
end"

when I use this code:
Code:
$rs_check = mysql_query("SELECT 'custid' FROM 'tbl_custs' WHERE 'custemail' ='".$vcustemail."'");
$check= mysql_num_rows($rs_check);

Does anyone see a reason why the mysql_query would pass an invalid result? the fields and variable are correct.

Thanks,
Hovercraft
 
If you asked MySQL it would tell you.

Something as simple as chaning one line to read:

$rs_check = mysql_query("SELECT 'custid' FROM 'tbl_custs' WHERE 'custemail' ='".$vcustemail."'") [red]or die(mysql_error())[/red];

would likely give you the debugging information you need.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Thanks Sleipnir,
This is the error I now receive.
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''tbl_custs' WHERE 'custemail' ='testemail'' at line 1
It's hard for me to tell where the issue is because of the error message quotes along with my single and double quotes.

So after I move the quotes around the string I get this error:
Parse error: parse error, unexpected $ in /home/teelogic/public_html/new_acct.php on line 41

I'm almost sure that the $ referenced is the one at the begining of the variable $vcustemail but I'm not sure and my eyes are now crossed.
 
If tbl_custs is a tablename, it should not have singlequotes around it. Some apps, like PHPMyAdmin, put backticks (that is the ` character [ASCII 96 decimal], not the ' character [ASCII 39 decimal]) around identifiers, but that's only necessary if you do the unwise act of using MySQL reserved words as identifiers. See


Want the best answers? Ask the best questions! TANSTAAFL!
 
That has got to be it.
Thanks Sleipnir, it's working!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top