/    Sign up×
Community /Pin to ProfileBookmark

Hopefully a Simple Query Question

[code=php]
$sql = “INSERT INTO tell (
name,
1,2,3,4,5,6,7,8,9,
comfort,
function,
health,
appearance,
precision,
peace_of_mind,
durability,
other,
other_blank,
money,
time,
personal_effort,
physical_discomfort,
fear_and_anxiety,
other2,
other_blank2
) values (
‘”.$_POST[‘name’].”‘,
‘”.$_POST[‘1’].”‘,'”.$_POST[‘2’].”‘,'”.$_POST[‘3’].”‘,'”.$_POST[‘4’].”‘,'”.$_POST[‘5’].”‘,'”.$_POST[‘6’].”‘,'”.$_POST[‘7’].”‘,'”.$_POST[‘8’].”‘,'”.$_POST[‘9’].”‘,
‘”.$_POST[‘comfort’].”‘,
‘”.$_POST[‘function’].”‘,
‘”.$_POST[‘health’].”‘,
‘”.$_POST[‘appearance’].”‘,
‘”.$_POST[‘precision’].”‘,
‘”.$_POST[‘peace_of_mind’].”‘,
‘”.$_POST[‘durability’].”‘,
‘”.$_POST[‘other’].”‘,
‘”.$_POST[‘other_blank’].”‘,
‘”.$_POST[‘money’].”‘,
‘”.$_POST[‘time’].”‘,
‘”.$_POST[‘personal_effort’].”‘,
‘”.$_POST[‘physical_discomfort’].”‘,
‘”.$_POST[‘fear_and_anxiety’].”‘,
‘”.$_POST[‘other2’].”‘,
‘”.$_POST[‘other_blank2’].”‘,
)”;
[/code]

I keep getting the following error when I submit my form:

You have an error in your SQL syntax near ‘1,2,3,4,5,6,7,8,9, comfort, function, health, appearance, ‘ at line 3

any ideas?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@bathurst_guyJul 27.2005 — removed
Copy linkTweet thisAlerts:
@CompGeek01Jul 27.2005 — An albeit old version of phpmyadmin won't even allow me to *make* a table with a single digit as a column title. You'll need to escape (I guess thats the right work) the digits, which you can do for all fields..

[code=php]
$sql = "INSERT INTO test (
name,
1, 2, 3, 4, 5, 6, 7, 8, 9,
comfort,
function,
health,
appearance,
precision,
peace_of_mind,
durability,
other,
other_blank,
money,
time,
personal_effort,
physical_discomfort,
fear_and_anxiety,
other2,
other_blank2)
[/code]
×

Success!

Help @New_to_PHP spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...