Pete wrote:
> In message <[EMAIL PROTECTED]>, chas_river <[EMAIL PROTECTED]>
> writes
>  >I just can't get my head around this.
>  >
>  >I have a database that is a directory of residents in my community. I
>  >have set up PHP scripts to display the entire directory either (1)
>  >alphabetically by name or (2) by street address. For both of these, I
>  >can display the date the database was last updated.
> 
> Do you mean - the date the database was last updated, the date the table
> was last updated, or the date the record was last updated?

Here's the beginning of the  code for one of the scripts:

<?php
function convert_datetime($datestamp, $format) {

     if ($datestamp!=0) {

         list($date, $time)=split(" ", $datestamp);

         list($year, $month, $day)=split("-", $date);

         list($hour, $minute, $second)=split(":", $time);

         $stampeddate=mktime($hour,$minute,$second,$month,$day,$year);

         $datestamp=date($format,$stampeddate);

         return $datestamp;

     }

}

?>

<?php

   include ("login.inc");

   $connection = mysql_connect($host,$user,$password)

        or die ("couldn't connect to server");

   $db = mysql_select_db($database,$connection)

        or die ("Couldn't select database");

   /* Display user address in a form */

   echo "<h1>Resident Directory</h1>\n";



/* ******************************************* */

$sql = "SHOW TABLE STATUS";

$result=mysql_query($sql);

if (!$result) {

    echo "Could not successfully run query ($sql) from DB: " . mysql_error();

    exit;

}

$row = mysql_fetch_array($result,MYSQL_ASSOC);

$newtime = convert_datetime($row['Update_time'], "M d, Y");

echo "<h3> Listed by address updated on {$newtime} </h3>\n";

Thanks.



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/CefplB/TM
--------------------------------------------------------------------~-> 

The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Reply via email to