firefox crashes if i try to run a simple while infinite loop
<?php require"connect.inc.php"; if(isset($_POST["search_name"]) && !empty($_POST["search_name"])){ $search_name=$_POST["search_name"]; $query = "SELECT `food` FROM `food` WHERE `food` like '$search_name'"; $query_run=mysql_query($query); $query_row=mysql_fetch_assoc($query_run); while($query_row){ echo $query_row["$search_name"]; } } ?>
i have already connected the above mentioned code to a database which is in "connect.inc.php" and when i try to run this simple php script, firefox crashes(though it is an infinite while loop) but if i tried the same code in google chrome, it automatically stops after 30 seconds without crashing...
An gyara
All Replies (2)
Firefox should display a warning to stop the script if it runs for too long. It is a feature to prevent crashes from infinite loops. I'm not sure if this warning applies to PHP, but you can try resetting it to see if that helps.
To do so, please follow these steps:
- Go to
about:config
- Click the I'll be careful, I promise! button
- Locate the
dom.max_script_run_time
integer - Right click the preference and click Reset
Note: You may need to restart Firefox for changes to take effect.
I am fluent is many programming languages, but PHP is not one of them. Therefore, I can't really test the issue on my computer. Do you have a link to the functioning code, so that I could test it?
If you are getting the Mozilla Crash Reporter form, your Firefox may have logged some data that would help track down the cause of the crash. You can submit that data to Mozilla and share it with forum volunteers to see whether it points to the solution. Please check the support article "Firefox crashes - asking for support" for steps to get those crash report IDs from the about:crashes page, and then post some of the recent ones here.