Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Pages: [1]
Send this topic | Print
Topic: flat files  (Read 165 times)
« on: October 10, 2008, 12:15:45 PM »
skitty54 Offline
Newbie

View Profile
*
Posts: 20



i need a database and im on the free plan. someone tell me how to code two things

1- a flat file with a table called users

2-a php script linking to that table.
Report to moderator   Logged

 
« Reply #1 on: November 25, 2008, 09:59:26 AM »
faran Offline
Newbie

View Profile WWW
*
Posts: 3



dear .
you can download http://www.promosi-web.com/script/guestbook/download/  Ardguest  Guest Book which is very nice example of PHP and Flat File You don't need any databse (MS Aceess , SQL or Oracle ) with it .
here http://www.spoono.com/php/tutorials/tutorial.php?id=32 you can read this tutorial Working with Flat Files .

Thanks
Report to moderator   Logged

« Reply #2 on: Yesterday at 05:58:05 PM »
Primate Offline
Newbie

View Profile
*
Posts: 14



You won't be using tables with flat files; tables are a database thing Tongue.

Basically, create a text file that looks like this (except use actual values):
Code:
username|password|email|age|otherinformation

Then, in PHP, you can use this code to read out this information:
Code:
<?php
$fp 
fopen('ile.txt','r');
if (!
$fp) {
echo 'ERROR: Unable to open file.</table></body></html>';
exit;
}
while (!
feof($fp)) {
$line fgets($fp1024);
list($field1$field2$field3$field4$field5) = split('\|'$line);
echo '
<tr>
<td>'
.$field1.'</td>
<td>'
.$field2.'</td>
<td>'
.$field3.'</td>
<td>'
.$field4.'</td>
<td>'
.$field5.'</td>
<td>'
.$field6.'</td>
</tr>'
;
$fp++;
}
fclose($fp);
?>

If you need more information, check out this site. It's got a great tutorial about flat files!
Report to moderator   Logged
 
Pages: [1]
Send this topic | Print
Jump to:  

Powered by SMF | SMF © 2006-2008, Simple Machines LLC