Re: [PHP] Re: PHP and MySQL SELECT COUNT (*)
Thanks all, I appreciate the follow ups and the help with the code. I'm still relatively new with this stuff, and never had any formal training, it's all just been learn as I go, and I have to learn fast as this project is relatively urgent to get completed. I plan on going through all of my code on all of these pages and cleaning it up at the end to make it more efficient, so I will use these tips to help do that. Thanks again to all who helped troubleshoot this. It is working great now and I think my bosses will be happy. =D Nathan Rixham [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] learn something new every day! cheers Micah :) Micah Gersten wrote: While it's true that '.' concatenates and ',' is a list separator, The comma is actually more appropriate in this instance since you are just outputting each piece. It saves the overhead of concatenation before output. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Nathan Rixham wrote: 6: vs ' when you use php will parse the enclosed string for variables, when you use ' it won't; so ' leads for faster code, and also encourages you to code strongly by closing strings and concatenating variables. Further it allows you to use valid html around attributes rather than the invalid ' 7: , vs . there is no vs :) to concatenate we use . (period) not , (comma) so for 6 7.. echo 'td' . $i['servername'] . '/td'; I'm going to stop there, hope it helps a little bit; and I won't go any further as half the fun is learning; so you finding out how to save time on queries and write your own db handlers etc is not my domain I reckons Regards nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL SELECT COUNT (*)
While it's true that '.' concatenates and ',' is a list separator, The comma is actually more appropriate in this instance since you are just outputting each piece. It saves the overhead of concatenation before output. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Nathan Rixham wrote: 6: vs ' when you use php will parse the enclosed string for variables, when you use ' it won't; so ' leads for faster code, and also encourages you to code strongly by closing strings and concatenating variables. Further it allows you to use valid html around attributes rather than the invalid ' 7: , vs . there is no vs :) to concatenate we use . (period) not , (comma) so for 6 7.. echo 'td' . $i['servername'] . '/td'; I'm going to stop there, hope it helps a little bit; and I won't go any further as half the fun is learning; so you finding out how to save time on queries and write your own db handlers etc is not my domain I reckons Regards nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL SELECT COUNT (*)
learn something new every day! cheers Micah :) Micah Gersten wrote: While it's true that '.' concatenates and ',' is a list separator, The comma is actually more appropriate in this instance since you are just outputting each piece. It saves the overhead of concatenation before output. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Nathan Rixham wrote: 6: vs ' when you use php will parse the enclosed string for variables, when you use ' it won't; so ' leads for faster code, and also encourages you to code strongly by closing strings and concatenating variables. Further it allows you to use valid html around attributes rather than the invalid ' 7: , vs . there is no vs :) to concatenate we use . (period) not , (comma) so for 6 7.. echo 'td' . $i['servername'] . '/td'; I'm going to stop there, hope it helps a little bit; and I won't go any further as half the fun is learning; so you finding out how to save time on queries and write your own db handlers etc is not my domain I reckons Regards nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL SELECT COUNT (*)
1: SQL in mysql queries /should/ use backticks (`) around database, table and column names, stop's them getting confused with variables or reserved words (like timestamp) and saves you future trouble :) .. which is a mysql-ism - no other database supports this. As soon as you need to use another db (regardless of whether it's this application or not), you're stuffed. For reserved word column names, you don't have much choice but don't do that in the first place ;) http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html Other db's will have a similar list - though in most cases, if it's a function or sql keyword (eg 'table'), it'll be reserved in all. further, you'll be needing to use AS to turn COUNT(steps) into a nice name like stepcount Which is also a mysql-ism. Most other db's don't let you use aggregate aliases in an order by clause (I think because the sql standard says don't do that). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php