Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing query

Status
Not open for further replies.

segment

ISP
Jun 15, 2004
225
US
I created a db query which works fine:

$db = new mysqldb("sample","root","","localhost");


$res2 = $db->query("SELECT b.id, c.fname, c.lname, c.creditcard, c.creditname,
c.creditexprmonth, c.creditexpyear, c.creditccv, bint.description,
brand.companyname, b.accountid, b.unitsused, b.firstbilldate, b.lastbilldate FROM billaccount as b, billbrand as brand,
billinterval as bint,billcreditinfo as c
WHERE brand.id=b.billbrand and bint.id = b.billinterval AND ((CURRENT_TIMESTAMP() - b.lastbilldate) > bint.time)");

foreach($res2 as $row) { echo $res2['lastbilldate'];

}

When try to print it, it does nothing...

<td align="center"><font size=2 color=black><? echo $res2['firstbilldate']; ?></td>
<td align="center"><font size=2 color=black><? echo $res2['lastbilldate']; ?> </td>

perl -e 'print $i=pack(c5,(40*2),sqrt(7600),(unpack(c,Q)-3+1+3+3-7),oct(104),10,oct(101));'
 
$res2 will contain a handle to the data -- it's very similar to the file handle returned by fopen(). And like file handles, you can't just print the handle, you have to use additional functions to pull data out of the handle.

Take a look at the example code on the PHP online manual page for mysql_fetch_assoc()



Want the best answers? Ask the best questions! TANSTAAFL!
 
$res2 = $db->query1row("select * from xxxxxx");

$fname = $res2['fname'];
$lastbill = $res2['lastbilldate'];
$firstbill = $res2['firstbilldate'];
$lname = $res2['lname'];

Took care of it

perl -e 'print $i=pack(c5,(40*2),sqrt(7600),(unpack(c,Q)-3+1+3+3-7),oct(104),10,oct(101));'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top