Jump to content


Photo

mysql_num_rows() error - SOLVED - SOLUTION INSIDE


  • Please log in to reply
1 reply to this topic

#1 Avalanche

Avalanche
  • Members
  • PipPipPip
  • Advanced Member
  • 73 posts

Posted 21 August 2003 - 10:48 PM

Hello. I\'m having a problem with my script.

This is the part that I\'m having the error at:
[php:1:7e732ad053] function makeRandomPassword() {

/*****************************/
/* */
/* Random Password Script */
/* Made By phpfreak */
/* */
/*****************************/

$salt = \"abchefghjkmnpqrstuvwxyz0123456789\";
srand((double)microtime()*1000000);
for ($i=0; $i <= 7; $i++) {
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
}
return $pass;
}

$RANDOM_key = makeRandomPassword();

$query_registercheckIV = mysql_query(\"SELECT * FROM $tbl_users WHERE key=\'$RANDOM_key\'\"); // set register check query IV
$number_matchammtIV = mysql_num_rows($query_registercheckIV) or die(mysql_error());; // count number of matches

if($number_matchammtIV > 0) { // check for duplicate keys
echo \"Sorry, an internal error has occurred. This is not your fault and it is nothing serious.
All that you must do is register again. Sorry for the inconvenience.<p>
<a href=\"register.php\">Click here to register again</a><br>\";
require(\"include/footer.php\"); // use footer file
exit();
}[/php:1:7e732ad053]
And here is the error I get:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/burnttoa/public_html/avalanche/bop/register.php on line 102You have an error in your SQL syntax near \'key=\'p6jh8t26\'\' at line 1
$tbl_users has been defined, and \"key\" is a valid field in the table defined.

Help please?

Thanks.
DEFINE("YOU","Spending Too Much Time On The Computer");

#2 Avalanche

Avalanche
  • Members
  • PipPipPip
  • Advanced Member
  • 73 posts

Posted 22 August 2003 - 02:55 AM

Okay, I figured it out.

Apparently it didn\'t like that I was asking about a field name \"key,\" so it was stubborn and kept giving me errors. I just changed the field from \"key\" to \"user_key\" and everything works perfectly.

All you need is a little bit of experimenting!

:wink:
DEFINE("YOU","Spending Too Much Time On The Computer");




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users