Jump to content

Scipt stopping half way through


cs1h

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/128709-scipt-stopping-half-way-through/
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.