sungpeng Posted October 17, 2014 Share Posted October 17, 2014 mysql_query("update pupils set record='running' where pid !='$testing[0]' AND pid !='$testing[1]' AND pid !='$testing[2]' AND pid !='$testing[3]' AND pid !='$testing[4]' etc ") Anyway to add in a loop ? Quote Link to comment https://forums.phpfreaks.com/topic/291873-adding-loop-in-mysql-query/ Share on other sites More sharing options...
Solution Barand Posted October 17, 2014 Solution Share Posted October 17, 2014 No, but you can $idlist = join(',', $testlist) mysql_query("update pupils set record='running' where pid NOT IN ($idlist)"); so the query looks like this, for example update pupils set record='running' where pid NOT IN (1,5,9,18) Quote Link to comment https://forums.phpfreaks.com/topic/291873-adding-loop-in-mysql-query/#findComment-1493969 Share on other sites More sharing options...
sungpeng Posted October 17, 2014 Author Share Posted October 17, 2014 Thank You Quote Link to comment https://forums.phpfreaks.com/topic/291873-adding-loop-in-mysql-query/#findComment-1493975 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.