Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-06-2006, 12:24 PM   PM User | #1
fqaisrani
New to the CF scene

 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
fqaisrani is an unknown quantity at this point
Need help in php-mysql and database design issues.

I am a computer science student and our main track is basically desktop application development. We also have some courses about internet applications (sites) and their development. Some questions are popping up in my mind regarding PHP and MySQL, any help will be great.

1. While creating a table we can specify default values and these values fill up the table if some of the fields are left blank by the user in the web-site forms and we are posting the values to our query. Or we can also make a little code to post the defaults values from our code. Which approach (using default values in MySQL or in code) is better in performance?

2. If in applications we have some values/variables almost fixed for a certain period, is it better to make a PHP include file for them instead of retrieving them from database every time?

3. Suppose we have 15+ fields (columns) in a database table, half of them are used very frequently, while other half is used occasionally. In such situation we can either make a single table with all information or we can make 2 tables, one holds the frequently used data while other holds the rarely used data. Which technique (using a single table or two) is better?

4. If in a situation, we have to save 2 integers in database and the 2nd one must have a value between 00-99 inclusively, and both the integers are needed together, should we save them as 2 different columns, or in a single column after concatenation, and when needed, we can split them in our code. E.g. 1st integer is 6522 and 2nd is 12 so we can save 652212 in a single column, or 6522 and 12 in different columns. What approach has better performance?

5. Sometime we can either use database triggers or can create some PHP code to avoid some situations, what method gives more efficiency?

6. Sometime we can use stored procedures or PHP code to perform certain action, which way is more robust and speedy?

Thank you in advance.
fqaisrani is offline   Reply With Quote
Old 05-06-2006, 02:29 PM   PM User | #2
guelphdad
Super Moderator


 
guelphdad's Avatar
 
Join Date: Mar 2006
Location: St. Catharines, Ontario Canada
Posts: 2,629
Thanks: 4
Thanked 147 Times in 138 Posts
guelphdad will become famous soon enoughguelphdad will become famous soon enough
Please don't double post in multiple areas. You will have people answering similar answers in both forums. If you think you have a question that belongs in two forums, just include a link in one of them that points to the question in the other forum. then people won't waste their time.

As for your questions, in general, never do anything in your scripting language that can be handled by your database.
guelphdad is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:42 AM.


Advertisement
Log in to turn off these ads.