macromedia.dreamweaver.appdev
[Top] [All Lists]

Re: PHP/MySQl/Apache

Subject: Re: PHP/MySQl/Apache
From: "Craig"
Date: Thu, 1 Nov 2007 22:35:20 -0000
Newsgroups: macromedia.dreamweaver.appdev

David,
I have this in an includes file:-
 <?
function getFileSize($strfilename)
{
$pathname='docs/';
$fullname=$pathname.$strfilename;
    if (file_exists($fullname)){
        $strsize = human(filesize($fullname));
        echo($strfilename.' : '.$strsize);
    } else {
        echo("no such file exists");
    }
   return;
}
function human($size)
{
   for($si = 0; $size >= 1024; $size /= 1024, $si++);
   return round($size, 1).substr(' kMG', $si, 1);
}
?>

Then I have this in a text field in the database: The file you wanted is 
<?php getFileSize('cover.pdf') ?>, including the file size.

Basically, I would have thought that there is no difference between the code 
(<?php getFileSize('cover.pdf') ?>) being embeded in the page or embeded in 
the page via the database. Surely its the same thing?
But, obviously not. So, how do I get the text onto the page via the 
database?

Craig


"David Powers" <david@xxxxxxxxxxx> wrote in message 
news:fgdjp7$eos$1@xxxxxxxxxxxxxxxxxxxxxxxx
> Craig wrote:
>> However, if I embed the same text, <?php getFileSize('cover.pdf') ?>, 
>> into my MySQL database, I get absolutely nothing at all.
>
> What do you expect to get? MySQL is a database that stores information. It 
> is not capable of parsing PHP. For that, you need to run a PHP script on 
> your webserver.
>
> Perhaps if you explained what it is that you want to do, you might get 
> some practical help.
>
> -- 
> David Powers, Adobe Community Expert
> Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
> Author, "PHP Solutions" (friends of ED)
> http://foundationphp.com/ 



<Prev in Thread] Current Thread [Next in Thread>