Jump to content

[SOLVED] while loop not stopping


rubing

Recommended Posts

I am trying to code a script that stops running when there are no results found in my table.  When i run this it says that the result set is 0, but it keeps executing.

 

 

                        $count =1;
		while ($count=1)
			{
		 	$api=mt_rand(10000000,99999999);
			$query="SELECT * FROM api WHERE api=".$api."";
			if ($results=$conn->query($query))
				{
				$row_cnt = $results->num_rows;
				printf("Result set has %d rows.\n", $row_cnt);
				if($row_cnt==0)
				    {
				           $count=0;
				    }
				$results->close();
				}

Link to comment
https://forums.phpfreaks.com/topic/120641-solved-while-loop-not-stopping/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.