Your $sql already contains a mysql_query. Why are you running it against it again, unless you have changed something. If $sql only contains your delete statement(without calling mysql_query), then do not put quotes around $sql,$dbh Otherwise, come back with what $sql and $dbh are assigned to be. That would probably help determine what the problem is.
MB jas <[EMAIL PROTECTED]> said: > Ok now that the sql statement is working I am getting an error on my result > function... here is the result function > $result = mysql_query("$sql, $dbh") or die(mysql_error()); > and here is the error I am recieving > You have an error in your SQL syntax near '1, 1' at line 1 > I dont know enough about php and mysql to understand what this means... is > there some kind of chart or definitions for error messages? I tried looking > on mysql.org and couldnt find anything specific. In any event, thanks in > advance. > Jas > <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Here is what your delete statement should look like: > > > > $sql = mysql_query("DELETE FROM $table_name WHERE id = '$id'",$dbh) or > > die(mysql_error()); > > > > Note the field name without the $ in front of it and the variable you are > > comparing it to with the $. > > > > One other note, in your table, you have id as a varchar(30) > auto_increment. > > As far as I know, auto_increment can only be used on INT() field types, > > unless I missed something there. If you do end up changing the field type > to > > INT, make sure you take the '' around the $id out. > > > > HTH > > > > MB > > > > > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > Ok now that I can see the error message how can I fix it... the syntax > looks > > > correct and the error I am recieving is as follows.... > > > > > > You have an error in your SQL syntax near '= 'id'' at line 1 > > > > > > And this is my statement, > > > $sql = mysql_query("DELETE FROM $table_name WHERE $id = 'id'",$dbh) or > > > die(mysql_error()); > > > Is there anywhere on php.net or mysql.org that give exact error > meanings? > > > Thanks again, > > > Jas > > > "Olinux" <[EMAIL PROTECTED]> wrote in message > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > jas, > > > > > > > > Try this: > > > > - Remove the @, it suppresses the error > > > > - change die("Could not execute query, please try > > > > again later"); to die(mysql_error()); > > > > > > > > > > > > $sql = mysql_query("DELETE FROM $table_name WHERE $id > > > > = 'id'",$dbh) or > > > > die(mysql_error()); > > > > > > > > olinux > > > > > > > > --- jas <[EMAIL PROTECTED]> wrote: > > > > > Can someone tell me how I can find out why I am > > > > > getting errors executing > > > > > queries when I try to delete items from a table? I > > > > > have 2 files... > > > > > file 1. - Queries database, displays results with > > > > > option to delete record > > > > > using a check box, code is as follows... > > > > > <?php > > > > <snip> > > > > > > > > > > > > __________________________________________________ > > > > Do You Yahoo!? > > > > Yahoo! Sports - Coverage of the 2002 Olympic Games > > > > http://sports.yahoo.com > > > > > > > > > > > > -- > > > 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