june_c21 Posted December 31, 2009 Share Posted December 31, 2009 Can someone tell me what's wrong with this code . can't execute , return no result ... $query1 = "Select id,department from event order by id desc"; $result1 = mysql_query($query1,$dblink); $myrow1 = mysql_fetch_row($result1); $no = "R0" . $myrow1[0] . " / "; $department =$myrow1[1] ; if ($department=='GF1') { $query2 = "Select gf1,id from dept_no "; $result2 = mysql_query($query2,$dblink); $myrow2 = mysql_fetch_row($result2); //echo "00"."$myrow2[0]"." / "; $query3 ="update dept_no set id=id+1, gf1=gf1+1"; $result3 = mysql_query($query3,$dblink); $no = $no . "GF1 / 0".$myrow2[0]. "/0".$myrow2[1]; } Link to comment https://forums.phpfreaks.com/topic/186773-error-in-this-line-of-code/ Share on other sites More sharing options...
PravinS Posted December 31, 2009 Share Posted December 31, 2009 Are you getting some error? Link to comment https://forums.phpfreaks.com/topic/186773-error-in-this-line-of-code/#findComment-986320 Share on other sites More sharing options...
june_c21 Posted December 31, 2009 Author Share Posted December 31, 2009 nope, i didn't get any error..... suppose there will update in the database but the value in the database still remain the same. Link to comment https://forums.phpfreaks.com/topic/186773-error-in-this-line-of-code/#findComment-986321 Share on other sites More sharing options...
The Little Guy Posted December 31, 2009 Share Posted December 31, 2009 try to change: $query3 ="update dept_no set id=id+1, gf1=gf1+1"; to: $query3 ="update dept_no set id=(id+1), gf1=(gf1+1)"; you may also want to add a WHERE clause... Link to comment https://forums.phpfreaks.com/topic/186773-error-in-this-line-of-code/#findComment-986330 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.