PICS Posted July 11, 2007 Share Posted July 11, 2007 I'm trying to change a field after the security code is valid but i don't think my code is right to change the field. Help me out please :] <?PHP $sc2=$_GET['sc']; $username="teteted"; $password="dfsfsdf"; $database="picstools_com_-_u"; mysql_connect('localhost',$username,$password); $query1=" UPDATE sms SET verify='yes' WHERE sc='$sc2'"; mysql_query($query1); echo "Record Updated"; @mysql_select_db($database) or die( "Unable to select database"); $query=" SELECT * FROM sms WHERE sc='$sc2'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $cell=mysql_result($result,$i,"cell"); $pw=mysql_result($result,$i,"pw"); $sc3=mysql_result($result,$i,"sc"); $vi="yes"; echo '<h1>Congratulations!</h1><br><br>Your Phone Number '.$cell.' Has Been Registered.'; ++$i; } ?> Quote Link to comment Share on other sites More sharing options...
per1os Posted July 11, 2007 Share Posted July 11, 2007 Closing the mysql connection is unnecessary and you are doing it before you call mysql_result. Chances are that is what is screwing you up. Also be wary of SQL Injection. Quote Link to comment Share on other sites More sharing options...
PICS Posted July 11, 2007 Author Share Posted July 11, 2007 thanks frost, that works but im getting an error... Warning: mysql_close(): no MySQL-Link resource supplied in /var/www/html/sms/verify2.php on line 35 Quote Link to comment Share on other sites More sharing options...
per1os Posted July 11, 2007 Share Posted July 11, 2007 Don't use mysql_close. www.php.net/mysql_close The connection automatically closes when the script is done running. Quote Link to comment Share on other sites More sharing options...
PICS Posted July 11, 2007 Author Share Posted July 11, 2007 thanks frost, works great now Quote Link to comment 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.