Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
05-06-2006, 12:24 PM #1
- Join Date
- May 2006
- Thanked 0 Times in 0 Posts
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.
05-06-2006, 02:29 PM #2
- Join Date
- Mar 2006
- St. Catharines, Ontario Canada
- Thanked 156 Times in 147 Posts
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.