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 ? Link to comment https://forums.phpfreaks.com/topic/291873-adding-loop-in-mysql-query/ Share on other sites More sharing options...
Barand Posted October 17, 2014 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) 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 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
Archived
This topic is now archived and is closed to further replies.