Results 1 to 3 of 3

Thread: PHP / Firebird

  1. #1
    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>";
    }
    Any suggestions is greatly appreciated.

    Thanks

  2. #2
    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.”

  3. #3
    you can extract date from timestamp value using cast

    SELECT cast('now' as date)
    FROM rdb$database

Similar Threads

  1. Firebird VPS Installation
    By latitude in forum Other Web Hosting Related Offers
    Replies: 0
    Last Post: 06-26-2006, 04:35 PM
  2. More firebird help
    By RDX1 in forum Web Hosting Lounge
    Replies: 8
    Last Post: 02-12-2004, 04:44 AM
  3. Firebird .7 help
    By RDX1 in forum Web Hosting Lounge
    Replies: 4
    Last Post: 02-07-2004, 04:27 AM
  4. Firebird?
    By gina_ in forum Web Hosting Lounge
    Replies: 18
    Last Post: 09-13-2003, 11:51 PM
  5. InterBase/Firebird???
    By Zoltron in forum Programming Discussion
    Replies: 1
    Last Post: 03-18-2003, 04:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •