> 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++)
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
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++)
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
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
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
6 matches
Mail list logo