#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    15
    Rep Power
    0
    Please could someone tell me where i am going wrong with the following coding. I have unable to locate a good tutorial on the UPDATE command anywhere.

    <?
    $userstablea = "xx";
    $dbName = "xxx";
    MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database");
    @mysql_select_db( "$dbName") or die( "Unable to select database");
    $result=mysql_query("UPDATE $usertablea SET make='$make', model='$model', engine='$engine', yearletter='$yearletter', year='$year', colour='$colour', mot='$mot', tax='$tax', mileage='$mileage', ad_text='$ad_text', price='$price' WHERE ID='$ID'")
    MYSQL_CLOSE();
    ?>

  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    14
    This is your code:
    I think the only thing your a missing is a link indentifier, see my revised code below this
    $userstablea = "xx";
    $dbName = "xxx";
    MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database");
    @mysql_select_db( "$dbName") or die( "Unable to select database");
    $result=mysql_query("UPDATE $usertablea SET make='$make', model='$model', engine='$engine', yearletter='$yearletter', year='$year', colour='$colour', mot='$mot', tax='$tax', mileage='$mileage', ad_text='$ad_text', price='$price' WHERE ID='$ID'")
    MYSQL_CLOSE();


    NEW CODE:
    $userstablea = "xx";
    $dbName = "xxx";
    $db = MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database");
    @mysql_select_db( "$dbName") or die( "Unable to select database");
    $result=mysql_query("UPDATE $usertablea SET make='$make', model='$model', engine='$engine', yearletter='$yearletter', year='$year', colour='$colour', mot='$mot', tax='$tax', mileage='$mileage', ad_text='$ad_text', price='$price' WHERE ID='$ID'", $db)
    MYSQL_CLOSE($db);

    Hope that helps
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    36
    Rep Power
    14
    I think that you are missing the semicolon at the end of your query
    $result=mysql_query("UPDATE $usertablea SET make='$make', model='$model', engine='$engine', yearletter='$yearletter', year='$year', colour='$colour', mot='$mot', tax='$tax', mileage='$mileage', ad_text='$ad_text', price='$price' WHERE ID='$ID'");

    Bill


    ------------------
    Thanks Dr.E.L.

Similar Threads

  1. mysql sum fields
    By blues82 in forum MySQL Help
    Replies: 8
    Last Post: February 12th, 2004, 09:00 AM
  2. Problem to update record in mysql
    By vb_good in forum MySQL Help
    Replies: 3
    Last Post: January 24th, 2004, 01:44 PM
  3. Validate PHP form and update MySQL table
    By tlugosi in forum PHP Development
    Replies: 2
    Last Post: January 18th, 2004, 02:26 PM
  4. detecting auto-increment fields with DBI (MySQL)
    By quelrat in forum Perl Programming
    Replies: 0
    Last Post: January 12th, 2004, 01:25 PM
  5. Mysql update: 0 rows Select: 1 row ?
    By Cyclefreak in forum MySQL Help
    Replies: 2
    Last Post: January 3rd, 2004, 10:06 AM

IMN logo majestic logo threadwatch logo seochat tools logo