Solved

mysql query needs changing from old to new mysql?

Posted on 2009-05-17
5
205 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
  • 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 108

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

930 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now