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!
Sorry I'm not an ASP person but are you checking for End of File or End or Records, like from a database. You example would clue me that you are looking through records. If that's the case couldn't you just do this.
If rs.EOF Then
Response.write "end of file"
Else
While Not rs.EOF
Response.write "not end of file"
rs.MoveNext
Wend
End If
mrvanjohnson,
You are right. I meant to the end of a record. Your example will always produce "End of records"
I am currently working on an internal mail script for a website and I want to show a message saying something like "You currently have no mail" instead of just a blank result whenever no mail exist.
If rs.EOF Then
Response.write "You currently have no mail"
Else
While Not rs.EOF
Response.write rs.fields("member")
Response.write rs.fields("subject")
Response.write rs.fields("date")
rs.MoveNext
Wend
End If
<?php
$row = mysql_fetch_array($result);
if ($row == false) // can use == or === here
echo "end of file";
else
{ // I would use these braces for clarity
while( $row)
{
echo "not end of file";
$row = mysql_fetch_array($result);
}
}
?>
<?php
$row = mysql_fetch_array($result);
if ($row == false) // can use == or === here
echo "You currently have no mail";
else
{ // I would use these braces for clarity
while( $row)
{
echo $row['member'];
echo $row['subject'];
echo $row['date'];
$row = mysql_fetch_array($result);
}
}
?>
Block A will ALWAYS produce the message " You currently have no mail", even if you do have mail. Block B will not produce this message if there is mail. (mail here being an assumed set of entries returned by the unseen query)