Posts: 2,536
Location: Western Maryland
|
Declare $sql outside of the while loop. It is a matter of scope in that you declare $sql nowhere until inside the while loop -- therefore, as far as PHP is concerned, that is the only place it exists. The way it is written now, your check if(!$sql) pass because $sql at that point is null. Also, even if you had declared $sql above the while loop, when you check it in the end, it will contain only the value of the very last loop iteration.
I am not sure why you are getting a blank screen, but you may want to start with a smaller set of data to update (perhaps all the id's under 5) and put some debug regarding the value of each $sql.
__________________
—Kyrnt
|