SQL error on spell forms.

Got a problem or suggestion?
relentless
Posts: 13

SQL error on spell forms.

Post#1 » Tue Oct 20, 2009 9:39 am

Hey Petu,

When I type anything in the form with a ' in it, it'll generate this error. Guess you need to addslash() to all the form fields in the backend.

spells.php
MYSQL_QUERY
SELECT spells.* FROM spells WHERE 1=1 AND name like '%prophet's%gift%' ORDER BY name
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 's%gift%' ORDER BY name' at line 3
Have you sourced the eqbrowser tables in your database ?

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /mnt/web8/31/73/51034773/htdocs/forest/webtools/spellss.php on line 51
# No spells found matching those criterias.
Just a heads up.

Relentless

relentless
Posts: 13

Re: SQL error on spell forms.

Post#2 » Tue Oct 20, 2009 9:41 am

Code: Select all

'%prophet's%gift%'


Also need to decode the HTML entities on the form field as well, in addition to the addslashes...not sure if you already store spaces as % in your tables.

User avatar
Topsy
Posts: 517
Contact:

Re: SQL error on spell forms.

Post#3 » Tue Oct 20, 2009 6:20 pm

Well until the fix gets implimented, you'll just have to put a \ before your '.

hope that helps :)

User avatar
Topsy
Posts: 517
Contact:

Re: SQL error on spell forms.

Post#4 » Mon Oct 26, 2009 5:07 pm

*fixed*
style=' border-width: 3px;
border-spacing: 2px;
border-style: double;
border-color: rgb(255, 204, 51);
border-collapse: collapse;'/>




*~{ Topsy Crits }~*



Koeril
Posts: 1764
Contact:

Re: SQL error on spell forms.

Post#5 » Wed Dec 09, 2009 4:47 pm

New error when searching any spell

spells.php
MYSQL_QUERY
AND name like '%Hallowed%' ORDER BY name
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 'AND name like '%Hallowed%' ORDER BY name' at line 1
Formerly known as:
Jerant the Loremaster - Cleric
Hans Poisondirk - Rogue
<Evolution>

User avatar
Topsy
Posts: 517
Contact:

Re: SQL error on spell forms.

Post#6 » Wed Dec 09, 2009 7:10 pm

fixed
style=' border-width: 3px;
border-spacing: 2px;
border-style: double;
border-color: rgb(255, 204, 51);
border-collapse: collapse;'/>




*~{ Topsy Crits }~*



Return to “Website”

Who is online

Users browsing this forum: No registered users and 0 guests