PHP mysql_fetch_array question

March 23, 2009 at 19:50:52
Specs: Windows XP Home, 2.797 GHz / 3053 MB
I'm in the process of making a file system database and so far its working out really good. The only problem is when I use the list command that I created I can't format the data HTML like table data and stuff that you can do with mysql_fetch_array. You use mysql_fetch_array with a while statement to list what you selected from the database and you can format the html that you want to use.

What I'm basically is asking is that how do you recreate the mysql_fetch_array?

For example I have a dfs/users/phantom/password.txt
dfs= folder/database
and password.txt= text/data

// Value Function //
function dfs_value($table,$name,$value,$newname=false,$data,$event){







echo"Opening File:$databaseselect/$table/$name/$value.dfs";
$fileopen=fopen("$databaseselect/$table/$name/$value.dfs",'r') or die("Could not open file");
echo fread($fileopen,filesize("$databaseselect/$table/$name/$value.dfs"));

$fileopen=fopen("$databaseselect/$table/$contents/$value.dfs",'r') or die("Could not open file");
echo fread($fileopen,filesize("$databaseselect/$table/$contents/$value.dfs")) ."


return $opendirectory;

echo"You have not used a valid command. Please fix this.";


and to use that function you would use something like:

echo dfs_value("users","1","password","","","List");

the list option will list all values that you selected which would be password.txt under each value.

I tried creating a function like dfs_fetch_array() but I still can't get it to work with the while statement like you can with the mysql_fetch_array().

I want to do this so I can for example put the list into a table and stuff but in order to do that I would have to go into the function it self and use the tablr html tag. I do not want to do that.

I just want it to work the same way the mysql_fetch_array does or smiler to it.

also dfs=Data For Sites

See More: PHP mysql_fetch_array question

Report •

March 24, 2009 at 11:20:01
If I am understanding you correctly you want to read records iteratively from a flat-file. If that is the case AND if you have each record on it's own line then just use file() which will read a file as an array with each line as an element in the array. You can then run a foreach() similar to doing a while loop with mysql_fetch_array()

Michael J

Report •
Related Solutions

Ask Question