0

The error : syntax error, unexpected T_STRING
But I checked all string objects and they worked separately..

mysql_query("INSERT INTO downloadlogs(id, name, ip, time) VALUES('" . $Gid. "', '" . $nFile . "', '" . $IP . "', '" . date("l jS \of F Y h:i:s A") . "')")or die(mysql_error());

I checked this with TextPad and I saw that the syntax was right.. so I don't know what is the problem...
Thank you in advanced.

6
Contributors
7
Replies
8
Views
5 Years
Discussion Span
Last Post by vaultdweller123
0

This is what is before the code above.

$finalFile = '/home/a6771073/public_html/dTemp/' . $nFile;
	copy('/home/a6771073/public_html/upload/' . $oFile, $finalFile);

I don't know how.. but it worked 2 minutes ago..

0

Hi,
Syntax is correct still Check before the sql statement line if ok you can try as:
store the sql statement in a variable ,execute the query then retrieve the value ,

0

Most of the times, such an error also reports on which line in your script the error is occurring. Does it not?

-1

The error : syntax error, unexpected T_STRING
But I checked all string objects and they worked separately..

mysql_query("INSERT INTO downloadlogs(id, name, ip, time) VALUES('" . $Gid. "', '" . $nFile . "', '" . $IP . "', '" . date("l jS \of F Y h:i:s A") . "')")or die(mysql_error());

date("l jS \of F Y h:i:s A") = Maybe the quotation marks are causing the issue?
either change them into single quote ' or put the format in an string and put the string there instead.

I used to have this issue and removing the Date("") from the query most often solved it.
A tip mate; Learn to use Unix Timestamps and save those in the DB instead of a Date-string.

0

date("l jS \of F Y h:i:s A") = Maybe the quotation marks are causing the issue?
either change them into single quote ' or put the format in an string and put the string there instead.

I used to have this issue and removing the Date("") from the query most often solved it.
A tip mate; Learn to use Unix Timestamps and save those in the DB instead of a Date-string.

i don't think so... i don't think the date function has to do with the error, the date() statement is concatenated correctly outside the string, so if you use and editor like notepad++ you will see the the concatenated strings is not broken

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.