1BJK903
1BJK903

Reputation: 177

unexpected t_string, can't seem to find a answer

I have a weird problem with a MySQL query...

It's weird because it does not seem like it has faults in it, but it has, apparently...

This is the query:

$lastmessage = execute_scalar(“SELECT message FROM messages WHERE nick = 'nick' ORDER BY date LIMIT 0,1”);

And the error I am getting, on the same line, is this:

parse error: syntax error, unexpected t_string

What am I doing wrong?

Upvotes: 1

Views: 112

Answers (1)

nkr
nkr

Reputation: 3058

You have to use "" or '' (which are in the ASCII charset) to note a string in PHP. In your code you are using which is a Unicode character.

With "" your code would look like this:

$lastmessage = execute_scalar("SELECT message FROM messages WHERE nick = 'nick' ORDER BY date LIMIT 0,1");

I think you copied the code from an website where the CMS automatically changed " to .

Upvotes: 2

Related Questions