...

View Full Version : haveing problem with code



sytodave88
09-07-2005, 09:49 PM
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/sytodave/public_html/test/activate.php on line 15


can some one help me


<?
/* Account activation script */

// Get database connection
include 'mysql_connect.php';

// Create variables from URL.

$userid = $_REQUEST['id'];
$code = $_REQUEST['code'];

$sql = mysql_query("UPDATE activation SET activated='1' WHERE userid='$userid' AND password='$code'");

$sql_doublecheck = mysql_query("SELECT * FROM activation WHERE userid='$userid' AND password='$code' AND activated='1'");
$doublecheck = mysql_num_rows($sql_doublecheck);

if($doublecheck == 0){
echo "<strong><font color=red>Your account could not be activated!</font></strong>";
} elseif ($doublecheck > 0) {
echo "<strong>Your account has been activated!</strong> You may login below!<br />";
include 'login.php';
}

?>

NancyJ
09-07-2005, 09:52 PM
This wont fix it, but it will give you the sql error. Basically your sql query is bombing out

<?
/* Account activation script */

// Get database connection
include 'mysql_connect.php';

// Create variables from URL.

$userid = $_REQUEST['id'];
$code = $_REQUEST['code'];

$sql = mysql_query("UPDATE activation SET activated='1' WHERE userid='$userid' AND password='$code'");

$sql_doublecheck = mysql_query("SELECT * FROM activation WHERE userid='$userid' AND password='$code' AND activated='1'") or die(mysql_error());
$doublecheck = mysql_num_rows($sql_doublecheck);

if($doublecheck == 0){
echo "<strong><font color=red>Your account could not be activated!</font></strong>";
} elseif ($doublecheck > 0) {
echo "<strong>Your account has been activated!</strong> You may login below!<br />";
include 'login.php';
}

?>

Nightfire
09-07-2005, 10:28 PM
I'd say you're getting the error from the big spaces you have here:


UPDATE activation SET activa

and


SELECT * FROM activation WHERE use

Should only have 1 space after 'activation' not 3

marek_mar
09-07-2005, 10:50 PM
I don't think it's becouse of aditional whitespace chars. I don't see any errors in thwe querys. Both may have the same typo or something...

Noodles24
09-07-2005, 10:57 PM
I'd say you're getting the error from the big spaces you have here:


UPDATE activation SET activa

and


SELECT * FROM activation WHERE use

Should only have 1 space after 'activation' not 3

SQL doesn't care about whitespace, as long as there's >1 space

Noodles24
09-07-2005, 10:58 PM
I would say that your code in mysql_connect.php isn't connecting properly

sytodave88
09-08-2005, 07:02 PM
could it be the datbase is not set up rite

Pro3110
09-09-2005, 03:09 AM
I would say that your code in mysql_connect.php isn't connecting properly

I think you are right. Maybe a missing comma or something "small" like that :D

Page



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum