Home > Archive > PHP DB > March 2004 > Re: [PHP-DB] tick mark `
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: [PHP-DB] tick mark `
|
|
| Jeffrey N Dyke 2004-03-26, 11:12 pm |
|
Why is it when I have this ` tick mark in my query it works fine, but
when I remove them it I get an error?
___________
This tells to mysql to NOT treat the word as the reserved word that it
_may_ be, but use it literally. and interval, i believe, is a reserved
word. It is much like escaping special characters with \
HTH
Jeff
____________
v: (847) 644 - 8914
f: (847) 866 - 1946
e: choffman@eclimb.net
w: www.eclimb.net
_________________________________
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
| |
| Doug Thompson 2004-03-26, 11:12 pm |
| Craig:
I don't see a reply to your question in today's posts.
"Backticks" or "tick marks" allow you to use reserved words for column names. Interval is a reserved word.
Hope you weren't waiting this long for a response.
Doug Thompson
Craig Hoffman wrote:
> Why is it when I have this ` tick mark in my query it works fine, but
> when I remove them it I get an error?
>
> 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 'interval, heartrate, morning_hr, hr_for_intervals, watts, rpms,
>
> Here is my query:
> $query = "INSERT INTO traininglog ( `user_id` , `power_level` , `weight`
> , `comments` , `workout` , `distance` , `time` , `interval` ,
> `heartrate` , `morning_hr` , `hr_for_intervals` , `watts` , `rpms` ,
> `date` , `time_upload` , `w _of` , `sleep` , `motivation` ,
> `workout_name` , `rpe` , `candence` , `crunchs` , `leg_raises` ,
> `situp_with_twist` , `superman` , `situps` , `russian_twist` ,
> `back_extensions` , `situp_crunchs` , `side_crunchs` ,
> `balance_bicycles` , `v_ups` , `leg_rotation` , `medicine_ball_throw` ,
> `pull_ups` , `push_ups` , `climbing` ) VALUES ($_POST[user_id],
> '$_POST[power_level]', $_POST[weight], '$_POST[comments]',
> '$_POST[workout]', '$_POST[distance]', '$_POST[time]' '.'
> '$_POST[interval]', $_POST[heartrate], $_POST[morning_hr],
> $_POST[hr_for_intervals], $_POST[watts], $_POST[rpms], $_POST[date],
> NOW('$_POST[time_upload]') '.'
> '$_POST[w _of]', $_POST[sleep], '$_POST[motivation]',
> '$_POST[workout_name]', $_POST[rpe], $_POST[candence], $_POST[crunchs],
> $_POST[leg_raises], $_POST[situp_with_twist] '.'
> $_POST[superman], $_POST[situps], $_POST[russian_twist],
> $_POST[back_extensions], $_POST[situp_crunchs], $_POST[side_crunchs],
> $_POST[balance_bicycles], $_POST[v_ups] '.'
> '$_POST[leg_rotation]', $_POST[medicine_ball_throw], $_POST[pull_ups],
> $_POST[push_ups], '$_POST[climbing]' )";__________________________________
> Craig Hoffman - eClimb Media
>
> v: (847) 644 - 8914
> f: (847) 866 - 1946
> e: choffman@eclimb.net
> w: www.eclimb.net
> _________________________________
>
|
|
|
|
|