pls help me fix sql error

Started on the old forum in March 2014 · view the original in the archive · old links redirect here

4 replies · 186 views · started 12 years ago · 1 min read

3 participants
jaidon20k Developer · 64 posts #1

SQLSTATE[42000]: Syntax error or access violation: 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 ' DESC limit 0, 5' at line 1 Raw SQL : SELECT a.A_countrycode, a.A_id, a.A_country FROM AOG_members a INNER JOIN AOG_online b ON a.A_id = b.A_mid ORDER BY b.A_time DESC limit 0, 5

subzero Super moderator Fellow · 3,954 posts #2

There a space or can be wrong value ..

try to cut the space like limit 0,5 ( example )

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

jaidon20k Developer · 64 posts #3

Thank it is fixed but i have another error again!

Time : 08:52:05
SQLSTATE[HY093]: Invalid parameter number
Raw SQL : SELECT COUNT(*) FROM `AOG_friends` WHERE ((`A_mid` = :id AND `A_to` = :to) OR (`A_mid` = :to AND `A_to` = :id)) AND `A_accepted` = 'yes'

Added after 3 minutes:

Real codes/script part

$AOG_re = $this->AOG_db->AOG_single("SELECT COUNT(*) FROM `AOG_friends` WHERE ((`A_mid` = :id AND `A_to` = :to) OR (`A_mid` = :to AND `A_to` = :id)) AND `A_accepted` = 'yes'", array('id'=>"$AOG_mid", 'to'=>"$AOG_to"));
something else Fellow · 2,296 posts #4

at a guess (without seeing what is defined in rest of script)

$AOG_re = $this->AOG_db->AOG_single("SELECT COUNT(*) FROM `AOG_friends` WHERE ((`A_mid` == $AOG_mid AND `A_to` == $AOG_to) OR (`A_mid` == $AOG_to AND `A_to` == $AOG_mid)) AND `A_accepted` == 'yes'");
jaidon20k Developer · 64 posts #5

Do you know that i using pdo to access my db for most security. What about the array to set the parameter

i know that your above code will work but not most secure

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close