www.webdeveloper.com
Results 1 to 3 of 3

Thread: mysql edit info by id

  1. #1
    Join Date
    Apr 2008
    Posts
    182

    mysql edit info by id

    hey im pretty new at mysql but i have got a site going that you post info on and it is recorded in the database

    but now i am trying to edit it from a webpage

    i can call up the info so its displayed and ready to be edited, but I cant save the edit to the same id

    when i do

    Code:
    mysql_query("INSERT INTO trailers
            (t_Name, t_Price, t_Loc, t_Desc, t_Loc_a, t_Loc_b, t_File) VALUES('$theName', '$thePrice', '$theTarget', '$theDesc', '$theTarget_a', '$theTarget_b', '$aFileName')  WHERE id = '$hold_Id' ") 
            or die(mysql_error());
    i get a error of
    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 'WHERE id = '193'' at line 2

  2. #2
    Join Date
    May 2007
    Location
    Cleveland, OH
    Posts
    1,403
    Use the UPDATE syntax.
    Code:
    UPDATE trailers SET t_Name = '$theName', t_Price = '$thePrice' ... WHERE id = $hold_ID;

  3. #3
    Join Date
    Apr 2008
    Posts
    182
    second time youve saved me today! thanks!

    regards
    Marcus

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