TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-21-2008, 11:50 PM   #1 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Confused mysql problem

Quote:
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 foremost network protocol analyzer, and is the de facto (and often de jure) st' at line 2
I am getting this error message from my query. No idea what it means. Any Ideas?

Code:
$sqlInsert = mysql_query("INSERT INTO table (win, lin, mac, recommended, sName , version , longDesc , license , added, updated, homepageLink , imageLink, timeInt, category, MainCategory)"."
	VALUES ('$win', '$lin', '$mac', '$recommended', '$sName', '$version', '$longDesc', '$license', '$added', '$updated', '$homepageLink', '$imageLink', '$timeInt', '$category', '$MainCategory')") or die(mysql_error());
CoryMathews is offline  
Reply With Quote
Old 02-22-2008, 12:29 AM   #2 (permalink)
The Acquainted
 
Join Date: Nov 2007
Posts: 154
Thanks: 31
SOCK is on a distinguished road
Default

You're trying to insert unescaped data. One of those variables is a string that has a single quote in it somewhere, indicated by "s foremost network protocol analyzer, and is the de facto (and often de jure) st" in the error message. My guess is that first 's' shown is part of a possessive noun, and the reason it's failing is because of the apostrophe (a single quote).

Your script is completely open to SQL injection. Escape them strings!!
__________________
I reject your reality, and substitute my own.
SOCK is offline  
Reply With Quote
The Following User Says Thank You to SOCK For This Useful Post:
CoryMathews (02-22-2008)
Old 02-22-2008, 12:33 AM   #3 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

thanks sock. so obvious now.
CoryMathews is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 05:36 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design