homepage Welcome to WebmasterWorld Guest from 50.17.27.205
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
trouble finding mysql error
malcolmcroucher




msg:3774945
 12:02 pm on Oct 28, 2008 (gmt 0)

$sql="INSERT INTO activity (activityid,companyid,activityname, along,ashort,image1,image2,image1alt, image2alt,duration,location1,location2,location3,city, province,country,code,departs,departspoint,departstime, return,hotelpickup,childpolicy,inclusion1,inclusion2, inclusion3,inclusion4,exclusion1,exclusion2,additionalinfo1, additionalinfo2,additionalinfo3,additionalinfo4,additionalinfo5, season1,s1start,s1end,s1price,season2,s2start,s2end,s2price, start,end,comboid,comboid2,comboid3,comboid4,comboid5,title, keywords,description,heading1,text1,text2,heading2,heading3, bold,link,link2,linkurl,linktitle,link2url,link2title)

VALUES

('$_POST[id]','$_POST[companyid]','$_POST[aname]','$_POST[along]', '$_POST[ashort]','$_POST[image1]','$_POST[imag2]','$_POST[imag1alt]', '$_POST[image2alt]','$_POST[duration]','$_POST[location1]','$_POST[location2]', '$_POST[location3]','$_POST[city]','$_POST[province]','$_POST[country]', '$_POST[code]','$_POST[departs]','$_POST[dpoint]','$_POST[depart]', '$_POST[return]','$_POST[hotelpick]','$_POST[child]','$_POST[in1]', '$_POST[in2]','$_POST[in3]','$_POST[in4]','$_POST[ex1]','$_POST[ex2]', '$_POST[add1]','$_POST[add2]','$_POST[add3]','$_POST[add4]','$_POST[add5]', '$_POST[season]','$_POST[s1s]','$_POST[s1e]','$_POST[s1p]','$_POST[season2]', '$_POST[s2s]','$_POST[s2e]','$_POST[s2p]','$_POST[start]','$_POST[end]', '$_POST[combo]','$_POST[combo2]','$_POST[combo3]','$_POST[combo4]', '$_POST[combo5]','$_POST[title]','$_POST[keywords]','$_POST[description]', '$_POST[text1]','$_POST[text2]','$_POST[heading2]','$_POST[heading3]', '$_POST[bold]','$_POST[link]','$_POST[link2]','$_POST[linku]','$_POST[linkt]', '$_POST[link2u]','$_POST[link2t]')";

This is the error i get from Mysql :

Error: 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 'return,hotelpickup,childpolicy,inclusion1,inclusion2,inclusion3,inclusion4,exclu' at line 1

[edited by: eelixduppy at 12:44 pm (utc) on Oct. 29, 2008]
[edit reason] side scroll [/edit]

 

nick279




msg:3774948
 12:09 pm on Oct 28, 2008 (gmt 0)

My god.

Look just restructure your query in the following fashion:-

INSERT INTO `table` SET
`field1` = '$value1',
`field2` = '$value2' ....

Then it will be much easier to debug. Make sure you space out your lines on a mysql query if it's that long it's ny on impossible to debug.

Good Luck

RonPK




msg:3774953
 12:24 pm on Oct 28, 2008 (gmt 0)

Malcolm, if you'd be kind enough to fix the horizontal scrolling, people might actually be able to read your post... I could hardly find the reply box. Thank you.

RonPK




msg:3775614
 9:58 am on Oct 29, 2008 (gmt 0)

btw, 'return' is a reserved word in MySQL, so you can't use it as a column name unless you quote it with backticks (`).

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved