MySQL table names in PHP code - Page 2

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Re: MySQL table names in PHP code

Guillaume wrote:
Quoted text here. Click to load it

No, backticks in MySQL table names has nothing to do with PHP.  They're
not used by other databases, but the syntax is identical in other
languages when calling MySQL.

It has nothing to do with PHP - which is why it is not documented in the
PHP manual (but it is in the MySQL manual - which should give you a hint).

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: MySQL table names in PHP code

Quoted text here. Click to load it
I was talking about Chuck's comment, which only concern was quotes vs
double quotes in PHP. Which indeed was the nearest to the NG subject,
though it may (or may not) be appropriate to the OP.

I mean, he would have said something not really exact, appropriate or
accurate, if OT then one could say "don't post if that's OT and possibly
While Chuck posted something that *may* be useless to the OP (depends on
what he really meant), but at least is related to the topic.


Re: MySQL table names in PHP code

Wow. OK, firstly thank you all  for the polite way you answered my
first question while pointing out that it was also OT. Other forums
are not always so kind.

Since I didn't realize that the backticks were SQL, I guess I
conflated them with quotes and double quotes to some extent.

I did actually ask two questions, the first one about the backticks
and then a secondary and much less important question about the quotes
vs double quotes issue so that I could read up on those and make sure
my understanding of them were thorough.

So I appreciate the responses I got to both answers. Thank you all.

Re: MySQL table names in PHP code

Quoted text here. Click to load it

Backticks (that's what they are called in programming, rather than
"accent graves") are identifier quotes in MySQL:

Generally, they are not required, unless the identifier (the name of a
database, a table, a field, or another entity within a database)
happens to be the same as a reserved word or can be construed as an
expression.  For example:

SELECT * FROM `select` WHERE id = 100;

In this case, you need to distinguish the table named `select` from
the beginning of the SELECT statement, so you have to use the

Quoted text here. Click to load it

Note that the name of the table includes a dash (aka the minus sign),
so if the name is not quoted, MySQL will be tempted to treat it as an
expression (7 minus 1_List), which, of course, is likely to produce an
SQL error.

Quoted text here. Click to load it

MySQL has a Web site, too, you know... :)

Quoted text here. Click to load it

Yes.  See the PHP Manual (and read up on the heredoc syntax, too,
while you are on the subject of strings):


Site Timeline