473,569 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Naming conventions in php referring to mysql databases

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
8 1794
e_*******@hotma il.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*******@attgl obal.net
=============== ===
May 27 '07 #2
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
On May 27, 3:33 pm, e_matt...@hotma il.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,str toupper) 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
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
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
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_*******@hotm ail.comwrote in message
news:11******** **************@ z28g2000prd.goo glegroups.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
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
sandy wrote:
Did Noah have dinosaurs on the arc or not?
.....forgot the smilie...
:-)
Jun 5 '07 #9

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

Similar topics

6
11773
by: Matthew Crouch | last post by:
Does anyone know where I could find a consensus (in mysql community) on naming conventions? Is there a published standard? I mean primarily the naming of tables and fields. Obviously, people use what works for them. But I'd like a look at any hard and fast rules that all or most people stick to.
7
2458
by: cmiddlebrook | last post by:
Hi there, I keep finding myself getting inconsistent with naming conventions for things like member variables, class names etc and I just want to find something that suits me and stick to it. I am wondering if there are any naming conventions around that are deemed suitable by the general C++ community. I have googled around and I can't...
1
6530
by: clintonG | last post by:
Does the use of DTD, XML Schema and similar constructs adopt the use of C# naming conventions? If so how do I make the distinction of how to apply C# conventions with XML elements, attributes and so on? Any referrals to resources that discuss or document XML Naming Conventions? -- <%= Clinton Gallagher, "Twice the Results -- Half the...
4
7138
by: Mark Broadbent | last post by:
stupid question time again to most of you experts but this is something that continually bothers me. I am trying to get into the habit of naming variables and controls in an assembly as per convensions. The thing is that Ive never really get the full reference to check against. Ive seen a couple of articles, but there always seems to be a bit...
3
4336
by: clintonG | last post by:
Does the use of DTD, XML Schema and similar constructs adopt the use of C# naming conventions? If so how do I make the distinction of how to apply C# conventions with XML elements, attributes and so on? Any referrals to resources that discuss or document XML Naming Conventions? -- <%= Clinton Gallagher, "Twice the Results -- Half the...
5
6152
by: rastaman | last post by:
Hi all, I know of the existence of Object Naming Conventions for Visual Basic 6. Now I'm reading some books about VB .NET, but the names used for the objects are button1, picturebox1, etc. I wonder if I can use the same naming conventions as for VB6 ? If so, what about the names for the new objects in .NET. Kind regards rastaman
4
1328
by: kd | last post by:
Hi All, What is the naming convention for objects? I checked the MSDN and found naming conventions for class members, etc; but could not find information on the objects. It would be great if anybody could provide me the link to the same. Thanks. kd
9
3799
by: kevininstructor | last post by:
Greetings, I am in the process of creating naming conventions for VB.NET controls i.e. CheckBox -> chkShowThisOnStartup ListBoxt -> lstSomeList What I am looking for other developers input for Window.Form controls and what they are using for naming controls.
1
801
by: Philipp Post | last post by:
Marcello, Not a big surprise as naming conventions have a lot to do with personal prefernces. There are a lot of threads in comp.databases and the other database groups. Just do a search for "naming conventions" in the groups. In my oppinion one of the good conventions is presented by Joe Celko in "SQL Programming Style". I would...
0
7618
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...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6287
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...
0
5223
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...
0
3657
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...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
946
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...

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.