Solved

mysql query needs changing from old to new mysql?

Posted on 2009-05-17
5
208 Views
Last Modified: 2012-05-07
I'm moving from a server with an old version of mysql 3.23.58  to a newer version, 5.0.45

In my php scripts, I have a query like this:

INSERT INTO oys_reports (city,code,condition,f,c) VALUES ('Baltimore IH','NAMD','na','61','16.1')

which doesn't seem to work with mysql 5, I just get a syntax error.

Is there a different way to do the same thing now?

Thanks,    Chris
0
Comment
Question by:St_Aug_Beach_Bum
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 28

Accepted Solution

by:
gamebits earned 500 total points
ID: 24408191
condition is a reserved word enclosed it between bactick `

INSERT INTO oys_reports (`city`, `code`, `condition`, `f`, `c`) VALUES ('Baltimore IH','NAMD','na','61','16.1')

0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 24408229
@gamebits: Nice Catch!  To avoid accidentally using a MySQL reserved word in my queries, I like to name columns like o_city, o_code, o_condition, etc.
0
 

Author Comment

by:St_Aug_Beach_Bum
ID: 24408260
All Right!  Thank you!

Gamebits gets the points, but thanks for the additional tidbit Ray.

Now for the stupid follow up question.  I'm going to copy the code and paste it in to fix this, but for the future, where are backticks on my keyboard?   Or do you just make them up with some kind of magic?
0
 
LVL 28

Expert Comment

by:gamebits
ID: 24408451
the key beside the key with the number one on your keyboard
0
 

Author Comment

by:St_Aug_Beach_Bum
ID: 24408476
`
ahh, got it!  `Thank you`!

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to use 2 ON statements in inner join 3 45
Help installing Laravel app on MAMP on MAC 7 58
Can't Find the Homepage on my site 4 47
Form not executing correctly 1 28
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question