kernelgpf Posted April 20, 2007 Share Posted April 20, 2007 $query=mysql_query("select todragonID,fromdragonID from dragonsmating"); $num=mysql_fetch_array($query); for($i=0;$i<$num;$i++){ $row=mysql_fetch_array($query); mysql_query("update dragons set atcave='yes' where id='$row[todragonID]'"); mysql_query("update dragons set atcave='yes' where id='$row[fromdragonID]'"); } mysql_query("truncate dragonsmating"); I've looked at it over and over again.. what's wrong with it? Link to comment https://forums.phpfreaks.com/topic/47822-resolved-simple-short-script-reaches-maximum-execution-time/ Share on other sites More sharing options...
Glyde Posted April 20, 2007 Share Posted April 20, 2007 $num should equal mysql_num_rows($query) instead of mysql_fetch_array($query) Link to comment https://forums.phpfreaks.com/topic/47822-resolved-simple-short-script-reaches-maximum-execution-time/#findComment-233667 Share on other sites More sharing options...
taith Posted April 20, 2007 Share Posted April 20, 2007 also... its much easier to do it this way... no icky stuffs... just plain and simple :-) $query=mysql_query("select todragonID,fromdragonID from dragonsmating"); while($row=mysql_fetch_array($query)){ mysql_query("update dragons set atcave='yes' where id='$row[todragonID]'"); mysql_query("update dragons set atcave='yes' where id='$row[fromdragonID]'"); } mysql_query("truncate dragonsmating"); Link to comment https://forums.phpfreaks.com/topic/47822-resolved-simple-short-script-reaches-maximum-execution-time/#findComment-233668 Share on other sites More sharing options...
kernelgpf Posted April 20, 2007 Author Share Posted April 20, 2007 Ah, so easy. Thanks guys. Link to comment https://forums.phpfreaks.com/topic/47822-resolved-simple-short-script-reaches-maximum-execution-time/#findComment-233669 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.