RE: won't delete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You have no assurance that the DELETE query was successful.  Your code echoes "...record deleted" regardless of the result.

See the manual about mysql_affected_rows(), then try something like

} elseif ($delete) {
    $sql = "DELETE FROM emails WHERE id=$id";
    $result = mysql_query($sql) or die ("Delete failed for record id=$id");
    if ($result) echo "mysql_affected_rows($result) record for id=$id deleted!<p>";
} else {


hth
Doug

On Tue, 8 Apr 2003 09:50:48 -0700, Cameron Showalter wrote:

>thanks for the quick reply.
>
>the rest of the script works fine, just the delete function gives this:
>
> DELETE FROM emails WHERE id=46 Record deleted!
>
>then if you page back and refresh, or simply go to phpmyadmin, id 46 (for
>example) is still there.  i'm guessing it is something fairly simply i keep
>overlooking.
>
>
>-- 
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux