Re: $query works but i still get a returned error
| From: | John W. Holmes | Date: | Thu, 20 Nov 2003 13:22:57 +0000 |
| Subject: | Re: $query works but i still get a returned error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170409@lists.php.net to get a copy of this message | ||
PAUL FERRIE wrote:
I am not sure what the problem is here. The script runs and deletes the relevent row but still returns "DATA from albums loaded row id 658 did not get sent Error deleting row! Warning: Cannot modify header information - headers already sent by (output started at /home/pferrie/public_html/vinrev/adm/deleteid.php:2) in /home/pferrie/public_html/vinrev/adm/deleteid.php on line 21You get this error because you echo display messages and errors before trying to do a header() redirect. You can't have any output before header().
"
<?
if (isset($_GET['tablename'])) {
echo "DATA from <b>{$_GET['tablename']}</b> loaded<br>";
} else {
echo "<i>$tablename</i> did not get sent<br>";
}
if (isset($_GET['id'])) {
Take a look at your form again, you're using POST.
if(isset($_POST['id'])) {
echo "row id= <b>{$_GET['id']}</b><br>";
} else {
echo "row id <i>$id</i> did not get sent<br>";
But you must have register_globals still on because $id is set with the same value as $_POST['id']...
} include("connection.php"); $query = mysql_query("DELETE FROM $tablename WHERE id= $id")or die("<br>therand that's why this query works, because $id is the correct value.
Might be missing the obvious, too. ;) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.comwas an error<br> tablename:= $tablename<br>row id:= $id"); if(!mysql_query($query)) {echo"Error deleting row!");} Header("Location: delete.php?success=$success"); ?> I am php newbie and might be missing the obviuos