473,796 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MySQL table names in PHP code

I'm learning PHP and MySQL. In the samples I work with, the SQL table
names are "escaped" in accent grave (`) marks, not in single or double
quotes.

Can anyone explain that?

For instance, I have the following:

$sql_command = "SELECT * from `7-1_List`";

I tried looking around on the php.net site, but clearly I'm not using
the right search terms.

While I'm asking, I think I've figured out how double quotes (")
differ from single quotes ('), but if there is a discussion that
someone can point me to, that would be very nice.

Thanks.
Jun 2 '08
23 1602
Jerry Stuckle wrote:
Chuck Anderson wrote:
>MikeB wrote:
>>I'm learning PHP and MySQL. In the samples I work with, the SQL table
names are "escaped" in accent grave (`) marks, not in single or double
quotes.

Can anyone explain that?

For instance, I have the following:

$sql_comman d = "SELECT * from `7-1_List`";

I tried looking around on the php.net site, but clearly I'm not using
the right search terms.

While I'm asking, I think I've figured out how double quotes (")
differ from single quotes ('), but if there is a discussion that
someone can point me to, that would be very nice.

Re: quotes - http://us.php.net/types.string


Good try, but it has nothing to do with the user's question.
His question (to quote) about "how double quotes (") differ from single
quotes (')?"

It's spot on, Jerry. Did you even bother to look? That page it has a
very thorough discussion of Variable parsing and how to use both types.
--
*************** **************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Nothing he's got he really needs
Twenty first century schizoid man.
*************** *************** *****

Jun 2 '08 #11
Chuck Anderson wrote:
Jerry Stuckle wrote:
>Chuck Anderson wrote:
>>MikeB wrote:

I'm learning PHP and MySQL. In the samples I work with, the SQL table
names are "escaped" in accent grave (`) marks, not in single or double
quotes.

Can anyone explain that?

For instance, I have the following:

$sql_comma nd = "SELECT * from `7-1_List`";

I tried looking around on the php.net site, but clearly I'm not using
the right search terms.

While I'm asking, I think I've figured out how double quotes (")
differ from single quotes ('), but if there is a discussion that
someone can point me to, that would be very nice.

Re: quotes - http://us.php.net/types.string


Good try, but it has nothing to do with the user's question.

His question (to quote) about "how double quotes (") differ from single
quotes (')?"
It's spot on, Jerry. Did you even bother to look? That page it has a
very thorough discussion of Variable parsing and how to use both types.

Read again. He was asking about back tickies (`) in MySQL statements,
not single quotes (') in PHP.

It had absolutely nothing to do with PHP strings.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 2 '08 #12
NC
On May 27, 7:00 pm, MikeB <MPBr...@gmail. comwrote:
>
I'm learning PHP and MySQL. In the samples I work with, the SQL table
names are "escaped" in accent grave (`) marks, not in single or double
quotes.
Backticks (that's what they are called in programming, rather than
"accent graves") are identifier quotes in MySQL:

http://dev.mysql.com/doc/refman/5.1/en/identifiers.html

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
backticks.
For instance, I have the following:

$sql_command = "SELECT * from `7-1_List`";
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.
I tried looking around on the php.net site
MySQL has a Web site, too, you know... :)
While I'm asking, I think I've figured out how double quotes (")
differ from single quotes ('), but if there is a discussion that
someone can point me to, that would be very nice.
Yes. See the PHP Manual (and read up on the heredoc syntax, too,
while you are on the subject of strings):

http://php.net/string

Cheers,
NC
Jun 2 '08 #13
Jerry Stuckle wrote:
Chuck Anderson wrote:
>Jerry Stuckle wrote:
>>Chuck Anderson wrote:
MikeB wrote:
I'm learning PHP and MySQL. In the samples I work with, the SQL table
names are "escaped" in accent grave (`) marks, not in single or double
quotes.
>
Can anyone explain that?
>
For instance, I have the following:
>
$sql_comman d = "SELECT * from `7-1_List`";
>
I tried looking around on the php.net site, but clearly I'm not using
the right search terms.
>
While I'm asking, I think I've figured out how double quotes (")
differ from single quotes ('), but if there is a discussion that
someone can point me to, that would be very nice.
>
>
Re: quotes - http://us.php.net/types.string

Good try, but it has nothing to do with the user's question.
His question (to quote) about "how double quotes (") differ from single
quotes (')?"
It's spot on, Jerry. Did you even bother to look? That page it has a
very thorough discussion of Variable parsing and how to use both types.
B.S.

Read again. He was asking about back tickies (`) in MySQL statements,
not single quotes (') in PHP.

It had absolutely nothing to do with PHP strings.
Du-uh ...... try again He spoke of both. Here I'll quote it for you again:
I'm learning PHP and MySQL ......
..... While I'm asking, I think I've figured out how double quotes (")
differ from single quotes ('), but if there is a discussion that
someone can point me to, that would be very nice.
Enough of this waste of time already. Haven't you better things to do?

Case closed.

--
*************** **************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Nothing he's got he really needs
Twenty first century schizoid man.
*************** *************** *****

Jun 2 '08 #14
Chuck Anderson wrote:
Jerry Stuckle wrote:
>Chuck Anderson wrote:
>>Jerry Stuckle wrote:

Chuck Anderson wrote:
MikeB wrote:
>
>I'm learning PHP and MySQL. In the samples I work with, the SQL
>table
>names are "escaped" in accent grave (`) marks, not in single or
>double
>quotes.
>>
>Can anyone explain that?
>>
>For instance, I have the following:
>>
>$sql_comma nd = "SELECT * from `7-1_List`";
>>
>I tried looking around on the php.net site, but clearly I'm not using
>the right search terms.
>>
>While I'm asking, I think I've figured out how double quotes (")
>differ from single quotes ('), but if there is a discussion that
>someone can point me to, that would be very nice.
>>
Re: quotes - http://us.php.net/types.string
>
>
Good try, but it has nothing to do with the user's question.

His question (to quote) about "how double quotes (") differ from
single quotes (')?"
It's spot on, Jerry. Did you even bother to look? That page it has
a very thorough discussion of Variable parsing and how to use both
types.
B.S.

Read again. He was asking about back tickies (`) in MySQL statements,
not single quotes (') in PHP.

It had absolutely nothing to do with PHP strings.

Du-uh ...... try again He spoke of both. Here I'll quote it for you
again:
>I'm learning PHP and MySQL ......
>..... While I'm asking, I think I've figured out how double quotes (")
differ from single quotes ('), but if there is a discussion that
someone can point me to, that would be very nice.

Enough of this waste of time already. Haven't you better things to do?

Case closed.
Yep, you obviously don't understand plain English.

"I'm learning PHP and MySQL. In the samples I work with, the SQL table
names are "escaped" in accent grave (`) marks, not in single or double
quotes.?"

That's his question - not single vs. double quotes.

You're right. Case closed.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 2 '08 #15
Jerry Stuckle wrote:
Chuck Anderson wrote:
>Jerry Stuckle wrote:
>>Chuck Anderson wrote:
Jerry Stuckle wrote:
Chuck Anderson wrote:
>
>
>
>MikeB wrote:
>>
>>
>>I'm learning PHP and MySQL. In the samples I work with, the SQL
>>table
>>names are "escaped" in accent grave (`) marks, not in single or
>>double
>>quotes.
>>>
>>Can anyone explain that?
>>>
>>For instance, I have the following:
>>>
>>$sql_comm and = "SELECT * from `7-1_List`";
>>>
>>I tried looking around on the php.net site, but clearly I'm not using
>>the right search terms.
>>>
>>While I'm asking, I think I've figured out how double quotes (")
>>differ from single quotes ('), but if there is a discussion that
>>someone can point me to, that would be very nice.
>>>
>>>
>Re: quotes - http://us.php.net/types.string
>>
>>
>>
Good try, but it has nothing to do with the user's question.
>
>
His question (to quote) about "how double quotes (") differ from
single quotes (')?"
It's spot on, Jerry. Did you even bother to look? That page it has
a very thorough discussion of Variable parsing and how to use both
types.
B.S.

Read again. He was asking about back tickies (`) in MySQL statements,
not single quotes (') in PHP.

It had absolutely nothing to do with PHP strings.
Du-uh ...... try again He spoke of both. Here I'll quote it for you
again:

>>I'm learning PHP and MySQL ......

..... While I'm asking, I think I've figured out how double quotes (")
differ from single quotes ('), but if there is a discussion that
someone can point me to, that would be very nice.
Enough of this waste of time already. Haven't you better things to do?

Case closed.


Yep, you obviously don't understand plain English.

"I'm learning PHP and MySQL. In the samples I work with, the SQL table
names are "escaped" in accent grave (`) marks, not in single or double
quotes.?"

That's his question - not single vs. double quotes.

You're right. Case closed.

Your assumption is clearly wrong.

--
*************** **************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Nothing he's got he really needs
Twenty first century schizoid man.
*************** *************** *****

Jun 2 '08 #16
Chuck Anderson a écrit :
Your assumption is clearly wrong.
Yeah, let's do an other discussion about good/bad assumptions, popcorn
anyone ?

(Yet I notice that the problem once again occurs with a MySQL related
problem... though it's not related at all :p)

Btw guys, you both are "false" in a way, cause you both make
assumptions. From the OP's post, all I can say is *MAYBE* he wanted to
definitely clear the ' vs " point, as long as having a solution for his
issue, *MAYBE* he didn't care at all in the end.
Don't just say he was thinking a way you're not sure about, yet again :)

Regards,
--
Guillaume
Jun 2 '08 #17
Chuck Anderson wrote:
Jerry Stuckle wrote:
>Chuck Anderson wrote:
>>Jerry Stuckle wrote:

Chuck Anderson wrote:
Jerry Stuckle wrote:
>
>Chuck Anderson wrote:
>>
>>
>>MikeB wrote:
>>>
>>>I'm learning PHP and MySQL. In the samples I work with, the SQL
>>>table
>>>names are "escaped" in accent grave (`) marks, not in single or
>>>double
>>>quotes .
>>>>
>>>Can anyone explain that?
>>>>
>>>For instance, I have the following:
>>>>
>>>$sql_com mand = "SELECT * from `7-1_List`";
>>>>
>>>I tried looking around on the php.net site, but clearly I'm not
>>>using
>>>the right search terms.
>>>>
>>>While I'm asking, I think I've figured out how double quotes (")
>>>differ from single quotes ('), but if there is a discussion that
>>>someon e can point me to, that would be very nice.
>>>>
>>Re: quotes - http://us.php.net/types.string
>>>
>>>
>Good try, but it has nothing to do with the user's question.
>>
His question (to quote) about "how double quotes (") differ from
single quotes (')?"
It's spot on, Jerry. Did you even bother to look? That page it
has a very thorough discussion of Variable parsing and how to use
both types.
>
>
B.S.
>
Read again. He was asking about back tickies (`) in MySQL
statements , not single quotes (') in PHP.

It had absolutely nothing to do with PHP strings.

Du-uh ...... try again He spoke of both. Here I'll quote it for you
again:
I'm learning PHP and MySQL ......
..... While I'm asking, I think I've figured out how double
quotes (")
differ from single quotes ('), but if there is a discussion that
someone can point me to, that would be very nice.

Enough of this waste of time already. Haven't you better things to do?

Case closed.


Yep, you obviously don't understand plain English.

"I'm learning PHP and MySQL. In the samples I work with, the SQL table
names are "escaped" in accent grave (`) marks, not in single or double
quotes.?"

That's his question - not single vs. double quotes.

You're right. Case closed.


Your assumption is clearly wrong.
Stoopid idiot. Can't even read plain English.

Better go back to first grade.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 2 '08 #18
Jerry Stuckle wrote:
Chuck Anderson wrote:
>Jerry Stuckle wrote:
>>Chuck Anderson wrote:

Jerry Stuckle wrote:

Chuck Anderson wrote:
>
>
>MikeB wrote:
>>
>>I'm learning PHP and MySQL. In the samples I work with, the SQL
>>table
>>names are "escaped" in accent grave (`) marks, not in single or
>>double
>>quotes.
>>>
>>Can anyone explain that?
>>>
>>For instance, I have the following:
>>>
>>$sql_comm and = "SELECT * from `7-1_List`";
>>>
>>I tried looking around on the php.net site, but clearly I'm not
>>using
>>the right search terms.
>>>
>>While I'm asking, I think I've figured out how double quotes (")
>>differ from single quotes ('), but if there is a discussion that
>>someone can point me to, that would be very nice.
>>>
>Re: quotes - http://us.php.net/types.string
>>
>>
Good try, but it has nothing to do with the user's question.
>
His question (to quote) about "how double quotes (") differ from
single quotes (')?"
It's spot on, Jerry. Did you even bother to look? That page it has
a very thorough discussion of Variable parsing and how to use both
types.
B.S.

Read again. He was asking about back tickies (`) in MySQL
statements, not single quotes (') in PHP.

It had absolutely nothing to do with PHP strings.

Du-uh ...... try again He spoke of both. Here I'll quote it for you
again:
>>I'm learning PHP and MySQL ......
>>..... While I'm asking, I think I've figured out how double quotes (")
differ from single quotes ('), but if there is a discussion that
someone can point me to, that would be very nice.

Enough of this waste of time already. Haven't you better things to do?

Case closed.

Yep, you obviously don't understand plain English.

"I'm learning PHP and MySQL. In the samples I work with, the SQL table
names are "escaped" in accent grave (`) marks, not in single or double
quotes.?"

That's his question - not single vs. double quotes.

You're right. Case closed.
Erm, Jerry, it is possible the OP asked 2 (two, more then one) question
in his post...
--
Rik Wasmus
....spamrun finished
Jun 2 '08 #19
Rik Wasmus wrote:
Jerry Stuckle wrote:
>Chuck Anderson wrote:
>>Jerry Stuckle wrote:
Chuck Anderson wrote:

Jerry Stuckle wrote:
>
>Chuck Anderson wrote:
>>
>>
>>MikeB wrote:
>>>
>>>I'm learning PHP and MySQL. In the samples I work with, the SQL
>>>table
>>>names are "escaped" in accent grave (`) marks, not in single or
>>>double
>>>quotes .
>>>>
>>>Can anyone explain that?
>>>>
>>>For instance, I have the following:
>>>>
>>>$sql_com mand = "SELECT * from `7-1_List`";
>>>>
>>>I tried looking around on the php.net site, but clearly I'm not
>>>using
>>>the right search terms.
>>>>
>>>While I'm asking, I think I've figured out how double quotes (")
>>>differ from single quotes ('), but if there is a discussion that
>>>someon e can point me to, that would be very nice.
>>>>
>>Re: quotes - http://us.php.net/types.string
>>>
>>>
>Good try, but it has nothing to do with the user's question.
>>
His question (to quote) about "how double quotes (") differ from
single quotes (')?"
It's spot on, Jerry. Did you even bother to look? That page it
has a very thorough discussion of Variable parsing and how to use
both types.
>
>
B.S.

Read again. He was asking about back tickies (`) in MySQL
statements , not single quotes (') in PHP.

It had absolutely nothing to do with PHP strings.

Du-uh ...... try again He spoke of both. Here I'll quote it for you
again:

I'm learning PHP and MySQL ......

..... While I'm asking, I think I've figured out how double quotes (")
differ from single quotes ('), but if there is a discussion that
someone can point me to, that would be very nice.

Enough of this waste of time already. Haven't you better things to do?

Case closed.

Yep, you obviously don't understand plain English.

"I'm learning PHP and MySQL. In the samples I work with, the SQL table
names are "escaped" in accent grave (`) marks, not in single or double
quotes.?"

That's his question - not single vs. double quotes.

You're right. Case closed.

Erm, Jerry, it is possible the OP asked 2 (two, more then one) question
in his post...
Hi, Rik,

Yes and no. His question was about the backticks. A side comment
related to him having single vs. double quotes figured out (he thinks).

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 2 '08 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3557
by: jacob nikom | last post by:
I would like to create data model for a group of stores. All stores in this group are very similar to each other, so it is natural to allocate one MySQL database per store. Each database is going to have very similar set of tables with content related to a particular store. Let's suppose each store has multiple departments which are also very similar to each other. In this case I would like to model the departments
0
3950
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest version of this document can be found at: http://prdownloads.sourceforge.net/souptonuts/README_mysql.txt?download
1
538
by: David | last post by:
Hi, I currently administer our MySQL db version 3.23.56 on a Linux Cobalt Qube server via an external fron-end piece of software. My Table Names have capital letters at the beginning, i.e. StockMovements, OrderLines..... We are now implementing a cross-over to a Windows Server 2003 machine. I have installed MySQL version 4.0.20a and initially it was stated as 4.0.20a-debug. I managed to find another piece of software to take it
1
1597
by: Neil Zanella | last post by:
Hello, Consider the following PostgreSQL or Oracle SQL DDL code: CREATE TABLE fooTable ( foo INTEGER, PRIMARY KEY (foo) ); CREATE TABLE barTable (
39
8433
by: Mairhtin O'Feannag | last post by:
Hello, I have a client (customer) who asked the question : "Why would I buy and use UDB, when MySql is free?" I had to say I was stunned. I have no experience with MySql, so I was left sort of stammering and sputtering, and managed to pull out something I heard a couple of years back - that there was no real transaction safety in MySql. In flight transactions could be lost.
39
3236
by: windandwaves | last post by:
Hi Folk I have to store up to eight boolean bits of information about an item in my database. e.g. with restaurant drive-through facility yellow windows
6
38531
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get through this without much trouble. Programming knowledge is not required. Index What is SQL? Why MySQL? Installing MySQL. Using the MySQL command line interface
39
5873
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f ISO-8859-1 -t UTF-8 mydb.sql mydb_utf8.sql mysqlCREATE DATABASE mydb_utf8 CHARACTER SET utf8 COLLATE utf8_general_ci;
1
9592
ssnaik84
by: ssnaik84 | last post by:
Hi Guys, Last year I got a chance to work with R&D team, which was working on DB scripts conversion.. Though there is migration tool available, it converts only tables and constraints.. Rest of things (stored procedures, functions).. we have to manually edit. That time, we face some interesting challenges.. I failed to document all of them, but whatever I can share with u.. I will try.. :) ...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9061
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6800
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5453
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.