Page 1 of 1

error in my syntax.....

Posted: Mon Sep 29, 2003 7:44 am
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.

Posted: Mon Sep 29, 2003 9:49 pm
by penguinboy
so... no one has any clue at all?

Posted: Mon Sep 29, 2003 11:14 pm
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?