| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Senior Member | Query error Hey i am getting a querry error from this line: PHP Code: 1. If there is any visible problem in that piece of code 2. How can i make it show the actual error instead of the die command that i gave it..if i remove that die command..it shows nothing.. |
| |
| | #3 (permalink) |
| Senior Member | hm it is like that..i duno y it added that space when i copy pasted it here :-s $query = "INSERT INTO mpg ('id','Manufacturer','Year','Car Name','Miles Per Gallon City', 'Miles Per Gallon Freeway','Year Gas Price') VALUES ('','$manufacturer','$year','$car_name','$mpgc','$ mpgf','$year_gas_price')"; mysql_query($query) or die ("Error, insert query failed"); |
| |
| | #4 (permalink) |
| SI: ServiceInteract | mysql_query("INSERT INTO mpg ('id','Manufacturer','Year','Car Name','Miles Per Gallon City', 'Miles Per Gallon Freeway','Year Gas Price') VALUES ('','$manufacturer','$year','$car_name','$mpgc','$ mpgf','$year_gas_price'")or die ("Error, insert query failed"); |
| |
| | #6 (permalink) |
| Buy my domains. | It's the same thing.. >__> Run the query in phpMyAdmin and post the error it gives you. I don't see anything that would just be wrong on its own, unless you can't have spaces in the column titles. The only other thing I see is ' around column names.. shouldn't it be ` or nothing? If you used spaces between items, it wouldn't put that space in by itself into $mpgf |
| |
| | #7 (permalink) |
| Stud Sausage | Always added error reporting to every query, this will gve you a more descriptive error as Dan said phpmyadmin will. Run this: PHP Code: The problem is (i suspect) that you are not using backticks for field names, instead you are using '. Correct query should be: Code: INSERT INTO `mpg` (`id`,`Manufacturer`,`Year`,`Car Name`,`Miles Per Gallon City`,
`Miles Per Gallon Freeway`,`Year Gas Price`)
VALUES ('','$manufacturer','$year','$car_name','$mpgc','$ mpgf','$year_gas_price')
Last edited by Matthew.; 01-02-2007 at 04:15 AM. |
| |
| | #8 (permalink) | |
| Senior Member | Quote:
PHP Code: PHP Code: EDIT Looks like Matthew. just beat me Last edited by filth@flexiwebhost; 01-02-2007 at 04:10 AM. | |
| |
| | #9 (permalink) | ||
| Stud Sausage | Quote:
Quote:
(having said that i normally extend my error logger into the mysql class so they do get hidden) | ||
| |
| | #10 (permalink) |
| Ultima Ratio Regum | Edit: *remider to self: Alway refresh before posting* Someone beat me to it..
__________________ |Internet, Games, Computer Talk|IP Whois + Geolocation|Geolocate your IP| |Dynamic Forum Sigs|2,900+ Free Flash Games| <meta name="Jedi Mind Trick" content="Buy my domains, you will!"> VoIPUSA.com-MyBlogging.com-ArrivingSoon.com-Nano.tv- Technology.ws-Ammo.us-Racing.cc-Privacy.ws |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |