Strange Character

G

George

Guest
Hi,

Can anyone explain this?

I was having problems with this php snippet which gets lines from my MySQL database:

$query = "SELECT * FROM repertoire WHERE group = 'baroque' ORDER BY composer ASC";

There seemed to be a syntax error here. I thought I would look in the dadabik source code, and see what the correct syntax is. The following now works:

$query = "SELECT * FROM repertoire WHERE `group` = 'baroque' ORDER BY composer ASC";

It's all to do with the ` character either side of "groups". This seems to be a grave accent (`), and is thus different from a single quote (').

In the dadabik source code, a subroutine is run which detects the MySQL version, and then uses the grave accent when the version is newer than 3.23.06 .

ie:

if ($mysql_server_version > 32306){
$quote = "`";
}

$quote is then used to enclose a number of words in the MySQL enquiries.

Can anyone explain all this to me? Why, and when, is this character used? Is it a grave accent, or something else? Why did it change for version 3.23.06?

Thanks for any help!

George
 
E

Eugenio

Guest
George wrote:
>
> Hi,
>
> Can anyone explain this?
>
> I was having problems with this php snippet which gets lines
> from my MySQL database:
>
> $query = "SELECT * FROM repertoire WHERE group = 'baroque'
> ORDER BY composer ASC";
>
> There seemed to be a syntax error here. I thought I would
> look in the dadabik source code, and see what the correct
> syntax is. The following now works:
>
> $query = "SELECT * FROM repertoire WHERE `group` = 'baroque'
> ORDER BY composer ASC";
>
> It's all to do with the ` character either side of "groups".
> This seems to be a grave accent (`), and is thus different
> from a single quote (').
>
> In the dadabik source code, a subroutine is run which detects
> the MySQL version, and then uses the grave accent when the
> version is newer than 3.23.06 .
>
> ie:
>
> if ($mysql_server_version > 32306){
> $quote = "`";
> }
 
Top