Print to file from php while loop

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Print to file from php while loop

Post by Celauran »

I'm not surprised. Like I said, it looks like your query isn't returning anything. Try echoing inside the loop and see if you get anything. I suspect you won't. Or just check how many rows are returned using mysql_num_rows()
scoobysteve
Forum Newbie
Posts: 14
Joined: Wed Jul 30, 2014 5:19 am

Re: Print to file from php while loop

Post by scoobysteve »

I dont understand because the code I used for the echo is the same as your code see below. And the echo works. so the query must be working ??

if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("cl49-listings", $con);
$result = mysql_query("SELECT * FROM tblproperties where icon1 = 'Active'");

while($row = mysql_fetch_array($result))

I placed my echo here and it works when I place your $output code it does not. ?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Print to file from php while loop

Post by Celauran »

scoobysteve wrote:so the query must be working ??
Don't assume. Check.
scoobysteve
Forum Newbie
Posts: 14
Joined: Wed Jul 30, 2014 5:19 am

Re: Print to file from php while loop

Post by scoobysteve »

all sorted now, Thank you so much guys its really appreciated. you guys rock cheers.
Steve
Post Reply