error in my syntax.....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
penguinboy
Forum Contributor
Posts: 171
Joined: Thu Nov 07, 2002 11:25 am

error in my syntax.....

Post by penguinboy »

well
i'm parsing some cs logs
and my mysql statement is failing
[ADMIN] (centersayex) The name (1)Player is not allowed on this server. You name has been changed to: -=[No*Skillz]=-How'd_you_do_that
there's the line i'm inserting
You have an error in your SQL syntax near 'you_do_that','L0929017.log')' at line 1
theres the error

Code: Select all

//$this_line_data = mysql_escape_string($this_line_data);
$this_line_data = addslashes($this_line_data);
mysql_query("INSERT INTO logs (`line`)VALUES('".$this_line_data."')") or die(mysql_error());
I've tried both mysql_escape_string & addslashes.
But they're not working.
.. or at least on this line they're not working.
The code has already inserted 4000+ records, but for some reason it fails on this line.
penguinboy
Forum Contributor
Posts: 171
Joined: Thu Nov 07, 2002 11:25 am

Post by penguinboy »

so... no one has any clue at all?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

hm, works fine for me but you'd better try

Code: Select all

$query = "INSERT INTO logs (`line`)VALUES('".$this_line_data."')";
mysql_query($query) or die($query . ': ' . mysql_error());
Looks like the string hasn't been escaped correctly.

May I ask what the benefit of putting the lines into a database is?
Post Reply