Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 2000051

Re: [PHP3] MySQL SELECT_DATE output problem within loop From: Thomas Deliduka (thomas <email protected>)
Date: 05/02/00

To get dates into a format I like, I do this:

$date = $r["entered"];
$datearray = explode("-", $date);

echo $datearray[1] . "/" . $datearray[2] . "/" . $datearray[0];

or if you want it in long form:

$mntary = array("January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December");

echo $mntary[$datearray[1]-1] . " " . $datearray[2] . ", " . $datearray[0];

On 5/2/00 9:33 AM Fates said:

<?
     mysql_connect("blah", "web", "blah");
     $query = "SELECT * FROM journaltable ORDER by ID";
     $result = mysql_db_query("journal", $query);

if ($result) {

echo "Found these entries in the database:<ul>";
 
          while ($r = mysql_fetch_array($result)) {
 
$date = $r["entered"];
//$newdate <file://$newdate> = 'SELECT DATE_FORMAT('$date', '%c/%d/%Y')';
doesn't work
// as entered from journaltable where whatever';
//$newdate <file://$newdatequery> = "SELECT DATE_FORMAT('2000-04-18',
'%c/%d/%Y') as $r["entered"]"; doesn't work
 
             $entry = $r["entry"];
            $entry=ereg_replace("\n","<br>",$entry);
    ?>
<TR>
<TD><? echo "$newdate"; ?></TD>
</TR>
 
<TD> <? echo "$entry"; ?></TD>
</FORM>
 
<?
}

-- 

Thomas Deliduka IT Manager -------------------- New Eve Media 5629 Westlake Drive Galloway, OH 43119-8498 Phone: 614-870-3098 Fax: 614-870-7486 Mobile: 614-537-6445

-- PHP 3 Mailing List <http://www.php.net/> To unsubscribe, send an empty message to php3-unsubscribe <email protected> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected> To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-admin <email protected>