JuntoOnline

General Categories => Geekapalooza => Technical Quandries => Topic started by: swolt on January 07, 2007, 10:29:19 PM

Title: PHP syntax problem
Post by: swolt on January 07, 2007, 10:29:19 PM
Here is my code:

Quotemysql_query("UPDATE ticket SET (location,problems,notes,quote,quote_total,status) VALUES
  ('$location','$problems','$notes','$quote','$quote_total','$status')") or die(mysql_error());

It's giving me an error. I think it's something stupid like I misplaced a " or something, but i can't find it. I've been looking at this crap all day and I think I'm just too close to it. Anyone on here know PHP/MySQL enough to point out the error?
Title: Re: PHP syntax problem
Post by: swolt on January 07, 2007, 10:40:58 PM
oh, duh, I got it. I had copied my INSERT code instead of writing new code for the UPDATE. The syntax should be:

Quotemysql_query("UPDATE ticket SET location=$location");

I should have used = instead of values
Title: Re: PHP syntax problem
Post by: ReBurn on January 07, 2007, 10:44:05 PM
Oh, it looked to me like you were missing an opening parentheses.  There is one more closing parentheses than there is opening one in your example.
Title: Re: PHP syntax problem
Post by: BigDun on January 07, 2007, 10:47:55 PM
I was going to suggest you display the variables' contents. Many times sql writes fail because the the variables contain a " or ' and are interpreted as part of the code.
Title: Re: PHP syntax problem
Post by: swolt on January 07, 2007, 11:24:24 PM
this is why I hate coding. I am really good at laying out the database in my head and creating a page flow. What I suck at is the actual coding.

I'm creating a new service database for work. It's really quite cool. My brother wrote most of the code, while I directed him with the database and flow. He finished most of it before he left for vacation, so I'm stuck trying to finish it up using his code. I just moved it to official beta.

If you guys want to check it out, here is what I have so far: www.joshuahenderson.com/ubek

It's ugly, I know. Angelo is really good with graphics so he said he would make it pretty once I had PHP part done. We are suppose to get together next week. Also the link all the way to the right doesn't work.

Feel free to add/edit stuff to the database. This is just a play server. Although if you figure out a way to drop the database, please don't :)