This is what I am using here:

$db = DB::connect("mysql://$username:$password@$hostName/$databaseName");

if (DB::iserror($db))

$sql = "SELECT idnum, title, DATE_FORMAT(date, '%W, %M %D \@ %l:%i%p'),
news FROM newslist ORDER BY idnum DESC";

$query = $db->query($sql);
if (DB::iserror($query))

while ($query->fetchInto($row)) {
                echo "\n<table>" .
                        "\n<tr>\n\t<td>$row[1] ID#$row[0]</td></tr>" .
                        "\n<tr>\n\t<td>Added $row[2]</td></tr>" .
                        "\n<tr>\n\t<td>$row[3]</td></tr>" .

I took out all the font formatting and stuff so its not so cluttered here.
but it works just dandy, although I know what you are talkng about, when
using the other way to connect it returns the name as whatever (like a
COUNT(*) does). Although, I never knew the AS var thing, so that will help
me with other stuff down the road!

I know this is nothing fancy, but it is just what I've been wanting to do
since before I started learning php and mysql. :)


On Mon, 30 Sep 2002, Jason Young wrote:

|No  problem!
|Refresh MY memory here.. I noticed you didn't return the DATE_FORMAT
|column "AS <var>" .. is that working okay? I seemed to think that it
|returned a long unwieldy column name.. maybe things are good.. let me
|know :-D

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to