Results 1 to 3 of 3
Thread: PHP / Firebird
Hybrid View
-
07-27-2009, 05:57 PM #1Web Hosting Master
- Join Date
- Jul 2004
- Location
- Memphis, TN
- Posts
- 1,225
PHP / Firebird
Having a bit of a issue here figuring this one out.
I have a script setup that pulls data from a couple of tables in a firebird database. In all, I pull about 5 fields..1 of them is a date field..the other is a currency field.
Date comes out as "07-27-2009 00:00:00"
Currency comes out as "24514.25"
What I'm trying to accomplish is this:
Have date only show 7-27-2009..I don't care about the 00:00:00 at the end..that means nothing to us. Not even sure why this was created this way, but I can't really change on the database side as the program that uses this database is a third party application..and my luck would be that the whole thing would crash.
Second, I need the currency formatted..well as currency..so we would see "$24,514.25".
Does anyone have a good way that I can either accomplish that in my select statement..or in my php code?
Here is an example of my that contains that part:
Code:echo "<table border=1 cellpadding=5 cellspacing=0 bgcolor=#99ccff bordercolor=#000070> <tr bgcolor=#ffffc0><td colspan=6></td></tr> <tr bgcolor=#bfccd2> <td>SO Number</td> <td>SO Date</td> <td>Open?</td> <td>Customer</td> <td>Total Price</td> <td>Sales Person</td> "; $result = ibase_query($conn, "select SO_HEADER.TOTAL_PRICE, SO_HEADER.SO_NUMBER, SO_HEADER.ENTRY_DATE, SO_HEADER.OPEN_FLAG, SO_HEADER.BILL_NAME, SALESPERSON.SALESPERSON_NAME from SO_HEADER, SALESPERSON where SO_HEADER.SPN_AUTO_KEY = SALESPERSON.SPN_AUTO_KEY and SO_HEADER.OPEN_FLAG='T' order by SO_HEADER.ENTRY_DATE"); if (!$result) { echo "<tr><td colspan=5>Error Fetching result!</td></tr> </table>"; } else { while ($row=ibase_fetch_object ($result)) { echo "<tr> <td>$row->SO_NUMBER</td> <td>$row->ENTRY_DATE</td> <td>$row->OPEN_FLAG</td> <td>$row->BILL_NAME</td> <td>$row->TOTAL_PRICE</td> <td>$row->SALESPERSON_NAME</td> </tr>"; } echo "</table>"; }
Thanks
-
07-27-2009, 06:05 PM #2Web Hosting Master
- Join Date
- Nov 2001
- Location
- Vancouver
- Posts
- 2,422
Lemme see... strings, and formatting, and PHP. 1+1=2 == sprintf
http://www.php.net/sprintf“Even those who arrange and design shrubberies are under
considerable economic stress at this period in history.”
-
07-28-2009, 07:10 AM #3New Member
- Join Date
- Mar 2004
- Posts
- 1
you can extract date from timestamp value using cast
SELECT cast('now' as date)
FROM rdb$database
Similar Threads
-
Firebird VPS Installation
By latitude in forum Other Web Hosting Related OffersReplies: 0Last Post: 06-26-2006, 04:35 PM -
More firebird help
By RDX1 in forum Web Hosting LoungeReplies: 8Last Post: 02-12-2004, 04:44 AM -
Firebird .7 help
By RDX1 in forum Web Hosting LoungeReplies: 4Last Post: 02-07-2004, 04:27 AM -
Firebird?
By gina_ in forum Web Hosting LoungeReplies: 18Last Post: 09-13-2003, 11:51 PM -
InterBase/Firebird???
By Zoltron in forum Programming DiscussionReplies: 1Last Post: 03-18-2003, 04:06 PM