Page 1 of 1
Help with if statement, when url var reaches record count.
Posted: Sun Feb 16, 2003 5:53 pm
by 3dron
THe following code increments my count variable in the url. But I can't get the conditional to work when the count reaches the record limit.
What am I missing?
if ($HTTP_GET_VARS['count'] == $totalRows_Record_count) {
echo"<META HTTP-EQUIV=\"refresh\" CONTENT=\"0; URL=lastpage.php\">";
}
else {
++$HTTP_GET_VARS['count'];
echo"<META HTTP-EQUIV=\"refresh\" CONTENT=\"0; URL=$HTTP_SERVER_VARS[PHP_SELF]?count=$HTTP_GET_VARS[count]\">";
}
Thanks for any help. You all have been invaluable.
ROn
Posted: Sun Feb 16, 2003 6:52 pm
by lazy_yogi
works for me
have you tried printing out .... to see if it contains anyting each time ?
yes, my total records are printed out everytime
Posted: Sun Feb 16, 2003 10:32 pm
by 3dron
My $totalRows_Record_count is printed out along with current record in the format
# of # 9 (i.e. 5 of 24)
But when the record reaches 24 it keeps going pas to 25 of 24 and beyond.
Am I missing some brackets, parenthesis, etc...
Re: Help with if statement, when url var reaches record coun
Posted: Sun Feb 16, 2003 11:19 pm
by gyardleydn
3dron wrote:THe following code increments my count variable in the url. But I can't get the conditional to work when the count reaches the record limit
Try starting by hard typing $HTTP_GET_VARS['count'] and $totalRows_Record_count prior to your if statement. . If this successfully changes the branching you could backtrack using
string gettype ( mixed var)
Code: Select all
$totalRows_Record_count = (integer) $totalRows_Record_count;
$HTTP_GET_VARSї'count'] = (integer) $HTTP_GET_VARSї'count'];
While this is unrelated to your problem and I don't want to be a harpy on this issue, you might consider using >= to protect yourself against malformed user input or a server error.
Posted: Mon Feb 17, 2003 12:07 am
by 3dron
Thanks all. THis helped me track the problem down.
The count value was changing because of an update query, between the time when the page echoed my record_count and the time the 'if' statement occured.