Darkmatter5 Posted October 27, 2008 Share Posted October 27, 2008 Here's the code <?php if(isset($_POST['code']) && isset($_POST['code'])) { $conn=mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql'); mysql_select_db($dbnameprim); $pagedb="members"; $code=$_POST['code']; $cntquery=mysql_query("SELECT COUNT(mem_username) FROM $dbnameprim.$pagedb WHERE activation_code='$code' ") or die(mysql_error()); list($count)=mysql_fetch_array($cntquery); if($count==1) { mysql_query("UPDATE $dbnameprim.$pagedb SET activated='1' WHERE activation_code='$code' ") or die(mysql_error()); $actquery=mysql_query("SELECT mem_username FROM $dbnameprim.$pagedb WHERE activation_code='$code' ") or die(mysql_error()); $result=mysql_query($actquery) or die($actquery. '<br>' .mysql_error()); $row=mysql_fetch_array($result); //echo "UPDATE $dbnameprim.$pagedb SET activated='1' WHERE activation_code='$code'<br>"; echo "Thank you for activating your account $row[mem_username]!<br> You may now login with your username and password."; } else { echo "That activation code doesn't match any record on file! Make sure you typed in the correct code.<br> If all else fails copy and paste the code from your activation email."; } mysql_close($conn); } ?> When the ACTIVATE button is pushed it produces the following error. "Resource id #10 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 'Resource id #10' at line 1" Can someone help me troubleshoot this? Quote Link to comment https://forums.phpfreaks.com/topic/130318-solved-help-with-error-resource-id-10/ Share on other sites More sharing options...
wildteen88 Posted October 27, 2008 Share Posted October 27, 2008 There error is coming from here, I have highlighted the problem errors $actquery=mysql_query("SELECT mem_username FROM $dbnameprim.$pagedb WHERE activation_code='$code' ") or die(mysql_error()); $result=mysql_query($actquery) or die($actquery. '<br>' .mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/130318-solved-help-with-error-resource-id-10/#findComment-675914 Share on other sites More sharing options...
Twister1004 Posted October 27, 2008 Share Posted October 27, 2008 When you use mysql_query(), it really returns a reference to a result resource, which is parsed by mysql_fetch_* functions. If you directly echo out the resource, PHP just gives you the resource number. You need to actually use one of those mysql_fetch_* functions. Quote Link to comment https://forums.phpfreaks.com/topic/130318-solved-help-with-error-resource-id-10/#findComment-675916 Share on other sites More sharing options...
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.