Jump to content


This topic is now archived and is closed to further replies.


writing to a file the result of a db

Recommended Posts

ok ... the stupid cow is back again ...
Well... i have a table in the db that has usernames and websites... i want to write only the websites of a certain user to a file... i can view the results for the user for example 120 ( i get the user by ?user=120 ) but i can not put them i a file one in a row. How can i go on with that?

Share this post

Link to post
Share on other sites
You can use a loop like so:

[code]$query = mysql_query("SELECT website FROM users");
while($row = mysql_fetch_assoc($query)) {
    if($row['website']) {
        $ret = $ret . $row['website'] . "\n";

When all is said and done, $ret will hold a variable with every website from the user table that had an entry (make the default website field NULL), put it in a file via whatever means you like, I don't think that was intended to be answered along with the above?

Of course, the mysql_query() will need changed unless I guessed correctly...

Share this post

Link to post
Share on other sites
I am sorry, cow, I have been unable to respond to your posts on the forums because of some server error I have encountered. I have the solutions to all of your recent questions, but you may need to contact me via YIM/AIM at FireRescueNREMT. That is of course if this message even goes through.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.