hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : PHP / Firebird
Reply

Forum Jump

PHP / Firebird

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 07-27-2009, 05:57 PM
cheyenne1212 cheyenne1212 is offline
Web 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>";
}
Any suggestions is greatly appreciated.

Thanks



Sponsored Links
  #2  
Old 07-27-2009, 06:05 PM
mwatkins mwatkins is offline
Web Hosting Master
 
Join Date: Nov 2001
Location: Vancouver
Posts: 2,416
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  
Old 07-28-2009, 07:10 AM
mariuz mariuz is offline
New Member
 
Join Date: Mar 2004
Posts: 1
you can extract date from timestamp value using cast

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

Sponsored Links
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Firebird VPS Installation guisalberto Other Web Hosting Related Offers 0 06-26-2006 04:35 PM
More firebird help RDX1 Web Hosting Lounge 8 02-12-2004 04:44 AM
Firebird .7 help RDX1 Web Hosting Lounge 4 02-07-2004 04:27 AM
Firebird? gina_ Web Hosting Lounge 18 09-13-2003 11:51 PM
InterBase/Firebird??? Zoltron Programming Discussion 1 03-18-2003 04:06 PM

Related posts from TheWhir.com
Title Type Date Posted


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?