RE: won't delete

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

 



Doug, Cameron:

I noticed the same thing too. Problem is, according to what Cameron said in
a previous e-mail, the syntax of the DELETE query seems to be right.
Cameron, did you insert the number 46 in the following line:

> > DELETE FROM emails WHERE id=46 Record deleted!

or was that the result of a query you actually performed? If you login to
the db via command line or through phpMyAdmin using using the SAME username
and password you supply in this script at run time, does the exact same
query ("DELETE FROM emails WHERE id=insert_some_valid_number_here;") delete
that record from the emails table?

> -----Original Message-----
> From: Doug Thompson [mailto:dthompson@brickbarn.com]
> Sent: Tuesday, April 08, 2003 1:31 PM
> To: php-db@lists.php.net
> Cc: Cameron Showalter
> Subject: RE:  won't delete
> 
> 
> 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
> 

-- 
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