www.webdeveloper.com
Results 1 to 5 of 5

Thread: [RESOLVED] delete multiple where

  1. #1
    Join Date
    Oct 2005
    Posts
    244

    resolved [RESOLVED] delete multiple where

    I am trying to delete a row in the mysql database where the username and name_site have to be correct.

    current code:
    PHP Code:
            include "inc.mysql_connect.php";
            
    $query "DELETE FROM 'personal_bookmarks' WHERE username='" $_SESSION['username'] . "' AND name_site='" $_POST['name_remove_site'] . "'";
            
    $result mysql_query($result) or die(mysql_error()); 
    This results into a nice syntax error.

    Could anyone tell me what i did wrong?

  2. #2
    Join Date
    Mar 2006
    Location
    mumbai, india
    Posts
    17
    try using addslashes and
    for
    $result = mysql_query($result) or die(mysql_error());
    make
    $result = mysql_query($query) or die(mysql_error());

  3. #3
    Join Date
    Oct 2005
    Posts
    244
    Code:
    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''personal_bookmarks' WHERE username='username' AND name_site='beef
    getting this error after replacing $result for $query, wich was kinda a dumb mistake >.<

  4. #4
    Join Date
    Mar 2006
    Location
    mumbai, india
    Posts
    17
    i guess u need not use single quotes for table name, i mean quotes r not needed, try with that removed, else with addslashes(most practical solution)
    \'table name'\ like this

  5. #5
    Join Date
    Oct 2005
    Posts
    244
    removing the single quote's helped, thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles