Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DB Insert Dilema

Status
Not open for further replies.

WilliamMute007

Programmer
Sep 30, 2007
116
GB
Hi Guys,

I dont know if am running insane or there's actually something wrong with my insert query that am just not seeing.

Any help will be much appreciated.. thanks in advance

Code:
"INSERT INTO `nrawardsc1`.`votes` (`id` ,
`restaurant_name` ,
`atmosphere` ,
`buka` ,
`business_lunch` ,
`chef` ,
`contemporary` ,
`creative_menu` ,
`customer_service` ,
`draw_soup` ,
`egusi_soup` ,
`entertainment` ,
`family_friendly` ,
`grilled_fish` ,
`nra_restaurant` ,
`outdoor_catering` ,
`pepper_soup` ,
`restaurant_decoration` ,
`rice_dish` ,
`sea_food` ,
`sunday_buffet` ,
`suya` ,
`takeaway` ,
`traditional_restaurant` ,
`traditional_soup` ,
`value_for_money` ,
`website` ,
`yam_pottage`
) VALUES ( NULL, 'restaurant', 'atmosphere', 'buka', 'business_lunch', 'chef', 'contemporary', 'creative_menu', 'customer_service', 'draw_soup', 'usi_soup', 'entertainment', 'family_friendly', 'grilled_fish', 'nra_restaurant', 'outdoor_catering', 'pepper_soup', 'restaurant_decoration', 'rice_dish', 'sea_food', 'sunday_buffet', 'suya', 'takeaway', 'traditional_restaurant', 'traditional_soup', 'value_for_money', 'website', 'yam_pottage')";

I keep getting the error

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"INSERT INTO `nrawardsc1`.`votes` (`id` ,
`restaurant_name` ,
`atmosphere` ,
' at line 1
 
What is that decimal point doing there?
Code:
INSERT INTO `nrawardsc1`[red]>>[/red].[red]<<[/red]`votes`

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I thaught the decimal point was needed? well I've taken it off but still the same problem.. :) anymore suggestions pls?
 
Why would it need to be there?

And what is 'votes'?

You can only insert into one table at a time.

So no decimal point or anything at that point except the table name.


----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thanks Vacunita, correction made and work! However, I noticed that what I actually wanted to do was a DB update really. I've tried experimenting with just two Table column but no luck in DB update... Any help on that please?

Code:
$query="UPDATE `votes` SET `restaurant_name`=`restaurant_name`+1 , `atmosphere`=`atmosphere`+1 WHERE `votes`.`restaurant_name`== '$var'";

Thank you so much
 
What's with the double equal sign?
Try a single one.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Do you get an error?


----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I've got it working now.. thanks for your help anyways. I used some of your tips too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top