arash Posted October 11, 2009 Posted October 11, 2009 hi. I need some help whith emailvalidations... I get this error:Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/arash/public_html/activation.php on line 11 Invalid Validation Code what is wrong here? and here is the code: <?php session_start(); include "mysql.php"; $c; if(!$_GET['code'] || !$_GET['act']) { die("Invalid Use Of System."); } else { $code=$_GET['code']; $cq=mysql_query("select * from confirm where code=$code",$c); if(mysql_num_rows($cq)== 0) { die("Invalid Validation Code"); } $r=mysql_fetch_array($cq); if($_GET['act'] == 'activate') { mysql_query("UPDATE users SET confirmed='1' WHERE userid={$r[user]}",$c); mysql_query("DELETE FROM confirm WHERE code=$code",$c); print "Account Validated! [url='login.php']Login[/url]"; } else if($_GET[act] == 'cancel') { mysql_query("DELETE FROM users WHERE userid={$r[user]}",$c); mysql_query("DELETE FROM confirm WHERE code=$code",$c); print "Your account has successfully been cancelled, Were sorry you had to leave.";exit; } else { die("Invalid Action."); } } ?> Quote
Gucci Mane Posted October 11, 2009 Posted October 11, 2009 email validation Set them up thru cpanel not a php file Quote
Curt Posted October 11, 2009 Posted October 11, 2009 are you using v1 or v2 ?... if your using v2 and if im not mistaking. you have to change mysql_num_rows into mysql_num_array but i could be wrong.... Quote
arash Posted October 11, 2009 Author Posted October 11, 2009 thanks for the reply... i did change it to array and now I get this error: Fatal error: Call to undefined function mysql_num_array() in /activation.php on line 11 Quote
Curt Posted October 12, 2009 Posted October 12, 2009 srry i guess i was mistaking... im still learning...:P hope u get it solved Quote
virtualshogun Posted October 12, 2009 Posted October 12, 2009 <?php session_start(); include "mysql.php"; $c; if(!$_GET['code'] || !$_GET['act']) { die("Invalid Use Of System."); } else { $code=$_GET['code']; $cq=mysql_query("select * from confirm where code=$code",$c); if(mysql_num_rows($cq) != 1) { die("Invalid Validation Code"); } $r=mysql_fetch_array($cq); if($_GET['act'] == 'activate') { mysql_query("UPDATE users SET confirmed='1' WHERE userid={$r[user]}",$c); mysql_query("DELETE FROM confirm WHERE code=$code",$c); print "Account Validated! Login"; } else if($_GET[act] == 'cancel') { mysql_query("DELETE FROM users WHERE userid={$r[user]}",$c); mysql_query("DELETE FROM confirm WHERE code=$code",$c); print "Your account has successfully been cancelled, Were sorry you had to leave.";exit; } else { die("Invalid Action."); } } ?> try != 1 if i follow this right you wanting to ensure $cq isnt empty if not 1 then throw a error, != 1 i may be wrong need to get some coffee :D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.