Ciao tutti,
When you display a big Date (date with time) from MySQL to a table using smarty, Smarty ends up showing NULL as value. You can follow these tips..
a) apply DATE function inside query.
b) use date_format:"d":"m":"Y" to show date as DD:MM:YY format. Remember if you want the output as DD-MM-YY you need date_format:"d"-"m"-"YY" so the idea is to put the seperator value in format like (: or / or -).
Example Query : SELECT DATE(yourdate column), name FROM yourTable WHERE condition.
Example Smarty display: (using section for tabular view)...
{section name=id loop=$Myresults}
table_row class="{cycle}"> {* Comment: If you want a odd even printing *}
table_data{$Myresults[id].name}/table_data
table_data{$Myresults[id].yourdate|date_format:"%d/%m/%Y"} /table_data
End table_row
{sectionelse}
table_row table data Nothing to display table data /table_row
{/section}
PS: Replace table_row with "tr" and tabledata with "td" ofcourse with angle brackets as blog was unable to show the html.
hope this helps someone.. enjoy !!
During my efforts in development of some tools i found a need of simple step by step guideline for solving problems. This is just a documentation for that. Hope it helps someone somewhere.
Friday, July 24, 2009
Thursday, July 2, 2009
How to Install Pear in PHP on WIndows
Dear friends,
if you have not installed pear at PHP installation time its very tricky. you can download http://pear.php.net/go-pear this file and save it as go-pear.php and run it using your web browser. This will automatically install your Pear library for you.
its simple and very easy. Remember to set the ENV_Path.
happy coding.
if you have not installed pear at PHP installation time its very tricky. you can download http://pear.php.net/go-pear this file and save it as go-pear.php and run it using your web browser. This will automatically install your Pear library for you.
its simple and very easy. Remember to set the ENV_Path.
happy coding.
Subscribe to:
Posts (Atom)