RE: [PHP] Else/For loop

2002-06-12 Thread David Freeman
> Being relatively new to php, I discovered the following > after about 2 hours of debugging last night and was wondering why??? > > I had the following code: > > if ( $num_results = 0 ) > { > echo "no records found"; > } > else > { > for ($i=0; $i < $num_results; $i++)

RE: [PHP] Else/For loop

2002-06-12 Thread Roberts, Mark
al Message- From: Christoph Starkmann [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 8:27 AM To: Roberts, Mark; '[EMAIL PROTECTED]' Subject: RE: [PHP] Else/For loop Hi Mark! > Being relatively new to php, I discovered the following after > about 2 hours > of

RE: [PHP] Else/For loop

2002-06-12 Thread Christoph Starkmann
Hi Mark! > Being relatively new to php, I discovered the following after > about 2 hours > of debugging last night and was wondering why??? > > I had the following code: > > if ( $num_results = 0 ) > { > echo "no records found"; > } > else > { > for ($i=0; $i < $num_results; $i++)

RE: [PHP] Else/For loop

2002-06-12 Thread Niklas Lampén
If you still have an error there, change if ($num_results = 0) to if ($num_results == 0) See the difference? Realize the error? Niklas -Original Message- From: Roberts, Mark [mailto:[EMAIL PROTECTED]] Sent: 12. kesäkuuta 2002 16:20 To: [EMAIL PROTECTED] Subject: [PHP] Else/For loop

Re: [PHP] Else/For loop

2002-06-12 Thread Justin French
Wouldn't you need if ( $num_results == 0 ) not if ( $num_results = 0 ) if you do the latter, it will allways be true, because you're setting the var... easy mistake to make! check out comparisons in the manual for more info. Justin French on 12/06/02 11:19 PM, Roberts, Mark ([EMAIL PROTEC

[PHP] Else/For loop

2002-06-12 Thread Roberts, Mark
Being relatively new to php, I discovered the following after about 2 hours of debugging last night and was wondering why??? I had the following code: if ( $num_results = 0 ) { echo "no records found"; } else { for ($i=0; $i < $num_results; $i++) { display