jeudi 30 juillet 2015

editing a text file on my host using php

i have created a website ..... suppose i have a webpage index.php and a txt file updateContent.txt How can I manipulate the txt file via the php code on my host???

i have tried this code but it doesnt work !!! and it say Unable to open file! is There another way?? or What?

//database connection
$quryForGetLastUpdate="SELECT englishword FROM allowedwords";
         $myfile = fopen("./updateContent.txt", "w") or die("Unable to open file!");
                foreach ($dbh->query($quryForGetLastUpdate) as $row){
                    //out the mean in txt file
                    $txt = $row['englishword'];
                    fwrite($myfile, $txt);
                }
fclose($myfile);

And its My Host Content... enter image description here




Aucun commentaire:

Enregistrer un commentaire