RON_ron Posted August 30, 2012 Share Posted August 30, 2012 my code with the problem: $res = sprintf("UPDATE student SET Pas = '%s' WHERE Mail = '%s'", mysql_real_escape_string($Ber), mysql_real_escape_string($Mail)); $resDone = mysql_query($res); I can not get this work? I don't see any mistake in this code?? Could someone please help... I tried echo ($res)... it was blank? (I can assure the variable names are correct) Link to comment https://forums.phpfreaks.com/topic/267786-mysql-update/ Share on other sites More sharing options...
darkfreaks Posted August 30, 2012 Share Posted August 30, 2012 could be a mysql syntax error try this and tell me what you get..... $resDone = mysql_query($res) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/267786-mysql-update/#findComment-1373762 Share on other sites More sharing options...
RON_ron Posted August 30, 2012 Author Share Posted August 30, 2012 Thanks for the reply darkfreaks. it's blank. Link to comment https://forums.phpfreaks.com/topic/267786-mysql-update/#findComment-1373764 Share on other sites More sharing options...
scootstah Posted August 30, 2012 Share Posted August 30, 2012 Thanks for the reply darkfreaks. it's blank. There is no syntax error in that line, and the code works fine for me. Post your whole code please. Link to comment https://forums.phpfreaks.com/topic/267786-mysql-update/#findComment-1373767 Share on other sites More sharing options...
RON_ron Posted August 30, 2012 Author Share Posted August 30, 2012 $query3 =sprintf("SELECT * FROM student WHERE Mail ='%s' AND Usr = '1'", mysql_real_escape_string($Mail)); $query3a = mysql_query($query3); if(mysql_num_rows($query3a) > 0){ $res = sprintf("UPDATE student SET Pas = '%s' WHERE Mail = '%s'", mysql_real_escape_string($Ber), mysql_real_escape_string($Mail)); $resDone = mysql_query($res); } Link to comment https://forums.phpfreaks.com/topic/267786-mysql-update/#findComment-1373768 Share on other sites More sharing options...
scootstah Posted August 30, 2012 Share Posted August 30, 2012 if(mysql_num_rows($query3a) > 0){ Are you sure that statement is true? Link to comment https://forums.phpfreaks.com/topic/267786-mysql-update/#findComment-1373771 Share on other sites More sharing options...
RON_ron Posted August 30, 2012 Author Share Posted August 30, 2012 of course it's correct. Link to comment https://forums.phpfreaks.com/topic/267786-mysql-update/#findComment-1373789 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.