Thread: Custom function
View Single Post
Old 03-06-2003, 10:41 PM   #1 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
Custom function

Hokay. Now I'm trying to return a value from a custom function, the modified date from the mysql database, formatted properly. This works perfectly if it's actually embedded into the script, doesnt work at all as a seperate included function.

PHP Code:
function getModDate($db_table) {
// modified date string
    
global $mod_date;
    
$mod_result mysql_query("SELECT DATE_FORMAT(DATE_SUB(modified, INTERVAL 3 HOUR),
                '%c/%d/%y @ %r') FROM $db_table ORDER BY modified DESC LIMIT 1"
);
    
$row mysql_fetch_array($mod_resultMYSQL_NUM);
    
$mod_date $row['0'];
    return 
$mod_date;

Since the value of $mod_date is changed into a string on the last line, why wouldn't it just return that value?
bdl is offline   Reply With Quote