Jump to content

Newbie with unexpected termination of page


curlytail

Recommended Posts

Hi all. My first post!

 

I am not a PHP programmer (sorry .NET man  :-\) but have been asked to add an image resizing script into a php page.

The page in question processes form data ready for a MYSQL query after uploading and resizing images.

 

This work successfully; images resized and uploaded and query posted no problem.

 

The problem is that the closing commands which redirect the page are not being excuted.

Here are the bare bones of the last part of the page:

 

$catInfo = explode("|", $_POST[selectCategory]);

$CategoryID = $catInfo[0];

$SubcategoryID = $catInfo[1];

 

$q1 = "insert into etc . . . .";

 

mysql_query($q1);

 

$last = mysql_insert_id();

 

}

 

header("location:info.php?id=$last");

exit();

 

?>

 

The page however remains blank and does not redirect. My knowledge of programming, whilst pretty profound, doesn't extend to PHP and I don't have the time to learn the entire language to debug this part.

Is this a common fault and one easily remedied?

If someone can point me int he right direction I'd be very grateful.

 

Thanks.

 

 

Add this to the top of your page:

 

<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);

 

If there are any errors (my bet is that "Output already Sent" error) then it will display them. If it is the output already sent, you cannot have any output (not even a whitespace at the top before <?php) to the browser before you call a header, as once output has been sent you are already in the body.

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.