By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,791 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

Naming conventions in php referring to mysql databases

P: n/a
Hello,

I am developing on a windows machine, and hosting on a linux server.
I have written my php code using table names like siteStats and column
names like userStatus. I have just realized the conflict this creates
when uploading to the live server; table siteStats is not recognized,
but table sitestats is recognized. The solution seems to be:

1 - change all table names (and other case-sensitive names) to an all-
lowercase convention, i.e. siteStats =sitestats or site_stats;
2 - change table names on live version, in the database itself, to
lowerUpper format.

I really like using the lowerUpper format because I find it annoying
to type underscores all the time, and lowerlower becomes hard to
read. However, it is more important to me that my live and local
scripts are identical.

Does anyone else use the lowerUpper format successfully for things
like mySql table names, when developing on windows and hosting on
linux? Any suggestions? Thank you.

May 27 '07 #1
Share this Question
Share on Google+
8 Replies


P: n/a
e_*******@hotmail.com wrote:
Hello,

I am developing on a windows machine, and hosting on a linux server.
I have written my php code using table names like siteStats and column
names like userStatus. I have just realized the conflict this creates
when uploading to the live server; table siteStats is not recognized,
but table sitestats is recognized. The solution seems to be:

1 - change all table names (and other case-sensitive names) to an all-
lowercase convention, i.e. siteStats =sitestats or site_stats;
2 - change table names on live version, in the database itself, to
lowerUpper format.

I really like using the lowerUpper format because I find it annoying
to type underscores all the time, and lowerlower becomes hard to
read. However, it is more important to me that my live and local
scripts are identical.

Does anyone else use the lowerUpper format successfully for things
like mySql table names, when developing on windows and hosting on
linux? Any suggestions? Thank you.
Either way works, as long as you are consistent. I use both (not at the
same time, typically), depending on the project. But I, too, prefer the
mixed case format - I find it easier to read. But some programmers
don't like it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 27 '07 #2

P: n/a
I have encountered the same problem. Developing applications on
Windows and deploying on Linux or deploying in both platforms. I
would strongly suggest you use all lowercase or use underscores. Any
other solution tends to crop up later on as annoying bugs.

May 27 '07 #3

P: n/a
On May 27, 3:33 pm, e_matt...@hotmail.com wrote:
I really like using the lowerUpper format because I find it annoying
to type underscores all the time, and lowerlower becomes hard to
read. However, it is more important to me that my live and local
scripts are identical.
You have a powerful ally in Terry Halpin, the information modeling
guru. I think it's good practice; I happen to think it's easy to read
and see in a group of characters, which is important when authoring
and maintaining code.
Does anyone else use the lowerUpper format successfully for things
like mySql table names, when developing on windows and hosting on
linux? Any suggestions? Thank you.
I use it. This is one of those areas where, if you have you SQL
interface properly configured as a singleton, you can parse and
transform (strtolower,strtoupper) on __call, instead of here and there
and everywhere. Using a library and filter contract pattern may be
useful, so that all table names are auto-transformed to lower or
upper. Unless you had a parsibly-transformative pattern (such as
String_To_Upper), I couldn't imagine how you'd accomplish what you're
describing using camel-case (bumpy-case, staggered-caps, lumpy-text,
whatever).

May 28 '07 #4

P: n/a
I am developing on a windows machine, and hosting on a linux server.
I have written my php code using table names like siteStats and column
names like userStatus. I have just realized the conflict this creates
when uploading to the live server; table siteStats is not recognized,
but table sitestats is recognized.
There is a server setting in MySQL that says how it treats table names
(add it to my.cnf if it does not exist). For linux, this defaults to "0"
(case sensitive), and for windows it erroneously defaults to "1"
(case-insensitive, stored as lower case). For your windows server, you
should set it to "2" (case-insensitive, stored as is). Even then, some
MySQL versions do not interpret this setting right (I have a 5.0x
version that gives a lower-case table name in the foreign key clauses of
a SHOW CREATE TABLE answer).

Hope this helps.
May 28 '07 #5

P: n/a
On May 28, 9:16 am, Dikkie Dik <nos...@nospam.orgwrote:
I am developing on a windows machine, and hosting on a linux server.
I have written my php code using table names like siteStats and column
names like userStatus. I have just realized the conflict this creates
when uploading to the live server; table siteStats is not recognized,
but table sitestats is recognized.

There is a server setting in MySQL that says how it treats table names
(add it to my.cnf if it does not exist). For linux, this defaults to "0"
(case sensitive), and for windows it erroneously defaults to "1"
(case-insensitive, stored as lower case). For your windows server, you
should set it to "2" (case-insensitive, stored as is). Even then, some
MySQL versions do not interpret this setting right (I have a 5.0x
version that gives a lower-case table name in the foreign key clauses of
a SHOW CREATE TABLE answer).

Hope this helps.

Thanks everyone; this has helped me develop an approach that will work
well for my projects.

May 29 '07 #6

P: n/a
I am from the old school where case sensitive software and operating systems
did not exist, so I was taught to use underscores as separators and not a
change in case. I therefore use lowercase for all my database/table/column
names and thus avoid problems when switching between Windows and non-Windows
platforms.

Case sensitive software sucks bigtime.

--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

<e_*******@hotmail.comwrote in message
news:11**********************@z28g2000prd.googlegr oups.com...
Hello,

I am developing on a windows machine, and hosting on a linux server.
I have written my php code using table names like siteStats and column
names like userStatus. I have just realized the conflict this creates
when uploading to the live server; table siteStats is not recognized,
but table sitestats is recognized. The solution seems to be:

1 - change all table names (and other case-sensitive names) to an all-
lowercase convention, i.e. siteStats =sitestats or site_stats;
2 - change table names on live version, in the database itself, to
lowerUpper format.

I really like using the lowerUpper format because I find it annoying
to type underscores all the time, and lowerlower becomes hard to
read. However, it is more important to me that my live and local
scripts are identical.

Does anyone else use the lowerUpper format successfully for things
like mySql table names, when developing on windows and hosting on
linux? Any suggestions? Thank you.

Jun 4 '07 #7

P: n/a
Tony Marston wrote:
I am from the old school where case sensitive software and operating systems
did not exist, so I was taught to use underscores as separators and not a
change in case. I therefore use lowercase for all my database/table/column
names and thus avoid problems when switching between Windows and non-Windows
platforms.

Case sensitive software sucks bigtime.
From before (the case sensitive) C, Kernighan/Ritchie and unix?
In that case perhaps you can settle the Tennessee creationist
museum controversy.

Did Noah have dinosaurs on the arc or not?
Jun 4 '07 #8

P: n/a
sandy wrote:
Did Noah have dinosaurs on the arc or not?
.....forgot the smilie...
:-)
Jun 5 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.