Welcome Guest!
Please login
If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:
- Receive Fast Advice
- Learn Programming Languages
- Get Professional Website Reviews
- Quick Troubleshooting Assistance
|
|
Format In Php Vs Mysql
This is a discussion on Format In Php Vs Mysql, within the MySQL section. This forum and the thread "Format In Php Vs Mysql" are both part of the Programming Your Website category.
![]() ![]() |
Oct 3 2008, 11:29 AM
Post
#1
|
|
|
New Squeeze ![]() Posts: 2 Joined: 3-October 08 |
Difference in speed?
Best practices? Personal preference? thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
|
Oct 3 2008, 11:45 AM
Post
#2
|
|
![]() Squeeze Machine ![]() Posts: 766 Joined: 13-February 08 From: Catching the squeezed drips downunder. |
Formatting in Mysql is the best and fastest way. Mysql is basically built to do this specifically, it's also lower in the operating system hierarchy meaning that it takes less time to execute. If you need to pull out formatted dates, numbers or strings make Mysql do it. There is rarely an occasion where it is better to have PHP do your formatting, PHP should receive the data formatted as you want it.
I had personal training from Chris Shiflett, a core programmer on the Zend II engine and this is one of the tips he gave me. -------------------- |
|
|
Oct 3 2008, 07:01 PM
Post
#3
|
|
![]() Squeeze Machine ![]() ![]() ![]() ![]() ![]() Posts: 733 Joined: 13-February 08 From: Borneo |
Pardon to interrupt, but I don't know what are you guys talking. Meaning, I know PHP, and I know MySQL but I don't know what are you talking. Did I miss something? Just for my curiosity and for the sake of learning, could you show me an example of what you are saying. Like, what does it look like in MySQL and what does it look like in PHP.
-------------------- |
|
|
Oct 5 2008, 11:04 AM
Post
#4
|
|
|
Master of the Universe ![]() Posts: 1,298 Joined: 15-February 08 From: London, England |
Pardon to interrupt, but I don't know what are you guys talking. Meaning, I know PHP, and I know MySQL but I don't know what are you talking. Did I miss something? Just for my curiosity and for the sake of learning, could you show me an example of what you are saying. Like, what does it look like in MySQL and what does it look like in PHP. Instead of using the date function in php.. http://www.php.net/date You use the date function in mysql http://dev.mysql.com/doc/refman/5.0/en/dat...ion_date-format While it is quicker to use a mysql formatting function it also ties your application to a certain type of database. This means that if you are running a site on MySQL and you want to port your site to something else you are going to have to rewrite those queries. -------------------- |
|
|
Oct 5 2008, 05:31 PM
Post
#5
|
|
![]() Rapid Squeezer ![]() ![]() ![]() ![]() Posts: 182 Joined: 19-February 08 From: Netherlands |
I always write it into the mysql db as an int(11) unix timestamp. So you say that's not the best way to go?
-------------------- fresh-style.nl - small webdesign & development projects |
|
|
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
4 | Jason | 268 | 15th February 2008 - 05:54 PM Last post by: Linda |
|||
![]() |
3 | thewal | 403 | 19th February 2008 - 03:32 PM Last post by: JasonStanley |
|||
![]() |
14 | JustinStudios | 368 | 17th March 2008 - 12:04 AM Last post by: Monie |
|||
![]() |
15 | Popje | 376 | 12th March 2008 - 10:56 AM Last post by: jamesicus |
|||
![]() |
26 | Popje | 757 | 28th July 2008 - 11:26 AM Last post by: Bruno |
|||






Oct 3 2008, 11:29 AM













