Page 1 of 1

Empty line allows script to run

Posted: Fri Nov 07, 2003 12:56 pm
by lloydie-t
I Have just had having an hour trying to make a script run and then by putting an extra line in it works OK. It is just a simple script to insert a record in to MySQL. Can anyone explain why this may be? Have a look at the codes:

working code

Code: Select all

$job_id = mysql_insert_id();
$sql="INSERT INTO actions (job_id, user_id, action_time, action_notes)
VALUES ('$job_id', '$user_id', '$today', '$action_notes')";

mysql_query($sql) or die('An error occured executing sql statement.  SQL='.$sql.'<br>'.mysql_error());
non working code

Code: Select all

$job_id = mysql_insert_id();
$sql="INSERT INTO actions (job_id, user_id, action_time, action_notes)
VALUES ('$job_id', '$user_id', '$today', '$action_notes')";
mysql_query($sql) or die('An error occured executing sql statement. SQL='.$sql.'<br>'.mysql_error());
WaDaYaThink

Posted: Fri Nov 07, 2003 6:21 pm
by m3mn0n
I've never heard of that happening before. 8O Very odd..

Posted: Fri Nov 07, 2003 9:48 pm
by Jade
Are you sure you didn't just forget to put in a semicolon at the end of your $sql statement? I know its there now, but that looks to me like the most possible explination.

Jade

Posted: Sat Nov 08, 2003 2:09 am
by lloydie-t
Believe me, all I done was put the cursor on it and hit return to sort the problem

Posted: Sat Nov 08, 2003 6:07 am
by JAM
And the error msg reads what?

Posted: Sat Nov 08, 2003 9:50 am
by lloydie-t
Exactly, no error message.

Posted: Mon Nov 10, 2003 5:28 am
by JAM
Extremely annoying =)

Now I'm fishing...
What editor do you use?
If you place the enitre setting $sql on one single, long row, still get the same error?