cs1h Posted October 16, 2008 Share Posted October 16, 2008 Hi, I have a script that gets a record from a database and then with the results checks if it matches a default value, if it does it doesn't produce any code. If it doesn't match then it produces the code. The problem is that the script seems to stop after it gets the results from the table. The code is <?php $code_1 = $_GET["c1"]; $code_2 = $_GET["c2"]; mysql_connect("localhost","aa","aa"); mysql_select_db("aa") or die("Unable to select database"); $result = mysql_query("SELECT * FROM aa WHERE code1='$code_1' AND code2='$code_2'") or die (mysql_error ()); $num_rows = mysql_num_rows($result) or die (mysql_error ()); if($num_rows == 0) { echo "Sorry we are expierencing problems, please try again later"; } else { while($row = mysql_fetch_array($result) or die (mysql_error ())) { $Photo_1 = $row['photo']; $Photo_2 = $row['photo_2']; $Photo_3 = $row['photo_3']; $Photo_4 = $row['photo_4']; echo "$Photo_1 $Photo_2 $Photo_3 $Photo_4"; } if($Photo_1 == "image_size_c.jpg"){ echo "crap";} else { $Photo_resized = resize($Photo,array("w"=>400)); echo "<div id=\"upload_form_photo_box\"> <label></label> <div align=\"center\"> Main Image <p> </p> <p><img src=\"$Photo_resized\" border=\"0\" class=\"picture_frame\" /></p> <p> </p> <p><img src=\"btn_left.jpg\" width=\"84\" height=\"20\" /><img src=\"btn_right.jpg\" width=\"82\" height=\"20\" /></p> </div> </div>"; } if($Photo_2 == "image_size_c.jpg"){ echo "crap2";} else { $Photo_resized_2 = resize($Photo,array("w"=>400)); echo "<div id=\"upload_form_photo_box\"> <label></label> <div align=\"center\"> Main Image <p> </p> <p><img src=\"$Photo_resized_2\" border=\"0\" class=\"picture_frame\" /></p> <p> </p> <p><img src=\"btn_left.jpg\" width=\"84\" height=\"20\" /><img src=\"btn_right.jpg\" width=\"82\" height=\"20\" /></p> </div> </div>"; } if($Photo_3 == "image_size_c.jpg"){ echo "crap3";} else { $Photo_resized_3 = resize($Photo,array("w"=>400)); echo "<div id=\"upload_form_photo_box\"> <label></label> <div align=\"center\"> Main Image <p> </p> <p><img src=\"$Photo_resized_3\" border=\"0\" class=\"picture_frame\" /></p> <p> </p> <p><img src=\"btn_left.jpg\" width=\"84\" height=\"20\" /><img src=\"btn_right.jpg\" width=\"82\" height=\"20\" /></p> </div> </div>"; } if($Photo_4 == "image_size_c.jpg"){ echo "crap4";} else { $Photo_resized_4 = resize($Photo,array("w"=>400)); echo "<div id=\"upload_form_photo_box\"> <label></label> <div align=\"center\"> Main Image <p> </p> <p><img src=\"$Photo_resized_4\" border=\"0\" class=\"picture_frame\" /></p> <p> </p> <p><img src=\"btn_left.jpg\" width=\"84\" height=\"20\" /><img src=\"btn_right.jpg\" width=\"82\" height=\"20\" /></p> </div> </div>"; } } ?> Does anyone know why this doesn't work? All help is very much appreciated. Thanks, Colin Quote Link to comment https://forums.phpfreaks.com/topic/128709-scipt-stopping-half-way-through/ Share on other sites More sharing options...
MadTechie Posted October 16, 2008 Share Posted October 16, 2008 i would guess that the resize function resizes the images.. this is probably running out of memory or timeing out Quote Link to comment https://forums.phpfreaks.com/topic/128709-scipt-stopping-half-way-through/#findComment-667033 Share on other sites More sharing options...
Maq Posted October 16, 2008 Share Posted October 16, 2008 Do you get any errors? If they're not turned on, put this at the top of your script: ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/128709-scipt-stopping-half-way-through/#findComment-667035 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.