ID: 9734
Updated by: cynic
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Bogus
Bug Type: MySQL related
PHP Version: 4.0.4pl1
Assigned To: 
Comments:

watch this:

mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| foo            |
+----------------+
1 row in set (0.00 sec)

mysql> select * from foo;
+--------------+
| bar          |
+--------------+
| 999999999.99 |
+--------------+
1 row in set (0.00 sec)

mysql> delete from foo where bar = 'hello';
Query OK, 0 rows affected (0.00 sec)

mysql>

the truth is that delete of 0 rows is NOT an error.

Previous Comments:
---------------------------------------------------------------------------

[2001-03-13 21:42:07] [EMAIL PROTECTED]
It seems like the DELETE query don't return any error so I have to test first for the 
existing of the element than if exist I'll delete it.


$db = mysql_connect("localhost", "root");
mysql_select_db("MY_DBASE", $db);
$Query="SELECT * FROM  MY_DATA WHERE MY_DATA.id=$id";
$result = mysql_query($Query, $db);
$rows = mysql_num_rows($result);
if ($rows>0) {
           $Query="DELETE FROM  MY_DATA WHERE MY_DATA.id=$id";
           mysql_query($Query, $db);
           print("<P align=center><font size=6 face=italic><strong>Recored 
                  $id deleted</strong></font>n"); 
        }
else { 
           printf ("<P align=center><font size=6 face=italic><strong>
                      Error deleting record!:</strong> %s</font>n", 
                      mysql_error ());
        }




---------------------------------------------------------------------------



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9734&edit=2


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to