[PHP-DEV] PHP 4.0 Bug #9734: Error From: ahmed <email protected>
Date: 03/13/01

From: ahmed <email protected>
Operating system: Unix
PHP version: 4.0.4pl1
PHP Bug Type: MySQL related
Bug description: Error

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 ());
        }

-- 
Edit Bug report at: http://bugs.php.net/?id=9734&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>