List:General Discussion« Previous MessageNext Message »
From:Steve Edberg Date:April 24 2001 12:10pm
Subject:Re: delete in mysql
View as plain text  
At 10:56 AM +0200 4/24/01, Sven Heising wrote:
>Hi list


When posting help requests, it's always helpful to include the error 
message you get. You can check quickly this via something like:

    mysql_query("DELETE FROM $dtable where loginid = '$userto' ")
    or
    mysql_error();

One possible problem is that $dbuser doesn't have delete privileges 
on $dbase on host $host. See the manual:

	http://www.mysql.com/doc/P/r/Privilege_system.html


>got a problem again....can't delete :
>
>$db=mysql_pconnect($host,$dbuser,$pass) or
>die($dbfehler);
>echo "$userto";
>
>mysql_query("use $dbase;");
>
>mysql_query("DELETE FROM $dtable where loginid = '$userto' ");
>
>
>what is wrong with this?
>
>thanx in advance
>
>sven
>


The above might not be an actual snippet of your program, but it's 
always good to check a query's success. For example:

    function your_database_error_function() {
       echo 'Database error: '.mysql_error();
       exit;
    }

    ...

    $ResultId = mysql_query("DELETE FROM $dtable where loginid = '$userto' ");

    if (!$ResultId) {
       your_database_error_function();
    }

    ...



-steve

-- 
+---------- KDVS 90.3fm Annual Fundraiser : 16 - 22 April 2001 ----------+
| Steve Edberg                           University of California, Davis |
| sbedberg@stripped                               Computer Consultant |
| http://aesric.ucdavis.edu/                  http://pgfsun.ucdavis.edu/ |
+----------------------------- www.kdvs.org -----------------------------+
Thread
delete in mysqlSven Heising24 Apr
  • Re: delete in mysqlSteve Edberg24 Apr