1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Mysql SET syntax problem...

Discussion in 'Web Design & Development' started by JiminSA, Jul 22, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    2,058
    I've been staring at these 2 lines of code for hours...
    PHP:
            mysql_query("UPDATE vehicle    SET datetime=' . $row['datetime'] . ', fullname=' . $row['fullname'] . ', email=' . $row['email'] . ', phone=' . $row['phone'] . ', cell=' . $row['cell'] . ', suburb=' . $row['suburb'] . ', make=' . $row['make'] . ', model=' . $row['model'] . ', year=' . $row['year'] . ', kms=' . $row['kms'] . ', colour=' . $row['colour'] . ', extras=' . $row['extras'] . ', servhist=' . $row['servhist'] . ', accidents=' . $row['accidents'] . ', settlement=' . $row['settlement'] . ', finhouse=' . $row['finhouse'] . ', monthsrem=' . $row['monthsrem'] . ', monthsarr=' . $row['monthsarr'] . ', amtrem=' . $row['amtrem'] . ', price=' . $row['price'] . ', comments=' . $row['comments'] . ', photos=' . $row['photos'] . ', nextpid=' . $row['nextpid'] . ', tprice=' . $row['tprice'] . ', rprice=' . $row['rprice'] . ', natis=' . $row['natis'] . ', pics4=' . $row['pics4'] . ', wcdisc=' . $row['wcdisc'] . ', aprice=' . $row['aprice'] . ', status=' . $row['status'] . ', notes=' . $row['notes'] . ' WHERE id=' . $id'")
            or die(
    mysql_error());
    and cannot see how I am getting
    Can someone either shoot me or show me where I'm wrong, please?
     
  2. allnodcoms

    allnodcoms

    Joined:
    Jun 30, 2007
    Messages:
    613
    Get rid of the '.' (dot) operator and the single quotes in the array references...
    Code:
    SET datetime='$row[datetime]',...
    That should do it!

    Danny
     
  3. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    2,058
    The syntax supremo strikes again:) and saved a bullet! Thanks Danny!
     
  4. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    2,058
    and this bugger?
    PHP:
            $result mysql_query = ("SELECT * FROM vehicle WHERE id=$vehicleid");
     
  5. allnodcoms

    allnodcoms

    Joined:
    Jun 30, 2007
    Messages:
    613
    No worries Jimbo! ;)

    Danny
     
  6. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    2,058
    I did actually get a warning on this one, which kinda threw me...
    and I've tried it like this
    PHP:
    $result mysql_query = ("SELECT * FROM vehicle WHERE id='$vehicleid'");
    with the same result:confused:
     
  7. allnodcoms

    allnodcoms

    Joined:
    Jun 30, 2007
    Messages:
    613
    What's that random "=" sign after mysql_query? ;)

    Danny
     
  8. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    2,058
    Sorry - having a "Blonde Day"!
     
  9. allnodcoms

    allnodcoms

    Joined:
    Jun 30, 2007
    Messages:
    613
    You have hair? :eek:

    Danny
     
  10. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1062104