> 1) Is there any PHP command that'll convert a MySQL database
> timestamp into a format that humans can read?!! For example, I want to
> change "20010822001245" into "00:12.45 on the 22-08-2001"?
<?
function dateMysqlToUnix($mysqltime)
{
$stamp = ereg_replace("[^0-9]", "", $mysqltime);
$year = substr($stamp, 0, 4);
$month = substr($stamp, 4, 2);
$day = substr($stamp, 6, 2);
$hour = substr($stamp, 8, 2);
$min = substr($stamp, 10, 2);
$sec = substr($stamp, 12, 2);
$unix = mktime($hour, $min, $sec, $month, $day, $year);
//echo "Unix timestamp: $unix<BR>\n";
return $unix;
}
?>
You could add a $dateformat input variable, and execute Date()
inside that function using it ... but I'll leave that one up to
you. This will change it into a unix timestamp acceptable to
the date() function.
> 2) This is the hard question. I have a script that gets values from a
> database and then includes a php page which contains "echo $variable" code
> to get the values from the database onto the page.
>
> What I want to do is have the PHP page code in the main script instead of
> being included externally. So i tried putting the code into a variable and
> then including, but it didnt work. Then I tried echoing the variable but
the
> PHP code isnt executed.
>
> If you dont fully understand my question, mail me. I'm really stuck and
> NEEDD HELP!!!
It sounds like you might be coming at this one from an odd approach...
for one, include()'ing a file doesn't execute it externally, and it's
probably the best way to do what I think you're trying to do, since you
can then change the one include()'d file in order to change all your
page layouts...
Jason
--
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
"Work now, freak later!"
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]