cowuser Posted March 8, 2006 Share Posted March 8, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/4417-writing-to-a-file-the-result-of-a-db/ Share on other sites More sharing options...
k.soule Posted March 11, 2006 Share Posted March 11, 2006 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"; }}[/code]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... Quote Link to comment https://forums.phpfreaks.com/topic/4417-writing-to-a-file-the-result-of-a-db/#findComment-16319 Share on other sites More sharing options...
txmedic03 Posted March 11, 2006 Share Posted March 11, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/4417-writing-to-a-file-the-result-of-a-db/#findComment-16330 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.