Jump to content


Photo

Another ERROR Please HELP ME!


  • Please log in to reply
4 replies to this topic

#1 jwk811

jwk811
  • Members
  • PipPipPip
  • Advanced Member
  • 714 posts

Posted 23 October 2006 - 07:36 PM

Whats wrong? This is the problem...
Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource in /home/content/j/w/k/jwk811/html/membership/activate.php on line 25
Heres the entire script...
<?php

/* Account activation script */

// Get database connection

include ( './db.php' );

// Create variables from URL.

// first check if it's already been activated

$sql = mysql_query ( "SELECT COUNT(*) AS total FROM users WHERE userid = '" . mysql_real_escape_string ( $_REQUEST['id'] ) . "' AND password = '" . mysql_real_escape_string ( $_REQUEST['code'] ) . "' AND activated = 1" ) or die ( 'Query Error: ' . mysql_error );

$found = mysql_fetch_assoc ( $sql );

if ( $found['total'] == 0 )
{
	$sql = mysql_query ( "UPDATE users SET activated = 1 WHERE userid = '" . mysql_real_escape_string ( $_REQUEST['id'] ) . "' AND password = '" . mysql_real_escape_string ( $_REQUEST['code'] ) . "'" ) or die ( 'Query Error: ' . mysql_error );
	
	if(strlen(mysql_error()) > 0)
	{
	die(mysql_error());
	}
	if ( mysql_affected_rows ( $sql ) == 0 )
	
	{
		echo "<strong><font color='red'>Your account could not be activated, no user found by that id or password!</font></strong>";
	}
	else
	{
		echo "<strong>Your account has been activated!</strong> You may login below!<br />";
		
		include ( './login.php' );
	}
}
?>
Heres line 25...
if ( mysql_affected_rows ( $sql ) == 0 )
If you can find what the problem is that would be great.

#2 pocobueno1388

pocobueno1388
  • Members
  • PipPipPip
  • Advanced Member
  • 3,369 posts
  • LocationPalm Beach, Florida

Posted 23 October 2006 - 09:09 PM

Try this:


<?php

/* Account activation script */

// Get database connection

include ( './db.php' );

// Create variables from URL.

// first check if it's already been activated

$sql = mysql_query ( "SELECT COUNT(*) AS total FROM users WHERE userid = '" . mysql_real_escape_string ( $_REQUEST['id'] ) . "' AND password = '" . mysql_real_escape_string ( $_REQUEST['code'] ) . "' AND activated = 1" ) or die ( 'Query Error: ' . mysql_error );

$found = mysql_fetch_assoc ( $sql );

if ( $found['total'] == 0 )
{
	$sql = mysql_query ( "UPDATE users SET activated = 1 WHERE userid = '" . mysql_real_escape_string ( $_REQUEST['id'] ) . "' AND password = '" . mysql_real_escape_string ( $_REQUEST['code'] ) . "'" ) or die ( 'Query Error: ' . mysql_error );

$num = mysql_num_rows($sql);
	
	if(strlen(mysql_error()) > 0)
	{
	die(mysql_error());
	}
	if ( $num == 0 )
	
	{
		echo "<strong><font color='red'>Your account could not be activated, no user found by that id or password!</font></strong>";
	}
	else
	{
		echo "<strong>Your account has been activated!</strong> You may login below!<br />";
		
		include ( './login.php' );
	}
}
?>


#3 jwk811

jwk811
  • Members
  • PipPipPip
  • Advanced Member
  • 714 posts

Posted 23 October 2006 - 09:29 PM

ahh... nope getting the same error

#4 jwk811

jwk811
  • Members
  • PipPipPip
  • Advanced Member
  • 714 posts

Posted 23 October 2006 - 09:37 PM

ive been having so much trouble with this account activation script.. i think im just not going to make it so they dont have to activate it.. maybe come back on this in a while its just driving me insane! im sure there will be many more problems for me to come with the rest of the membership tutorial so far ive made it there and now im gonna have to play around with the script since im not goin to do this.. which im not very good at yet..

#5 jwk811

jwk811
  • Members
  • PipPipPip
  • Advanced Member
  • 714 posts

Posted 25 October 2006 - 09:39 PM

YES I GOT IT TO WORK!! IM SO HAPPY FOR ME!! lol it was just some stupid thing.. the passwords wouldnt match because the cell in the database table wasn't big enough to fit the md5 password.. i got the first one i was trying to work to work not this one but ill try that now.. im sure there will be more problems to come lol




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users