this seems simple, but i'm running into confusion:
i have the following very simple SQL statement:
my $sql = "SELECT UID FROM news";
and then the following loop to match the requested UID with the results of the query, and identify the previous and next records:
while (my $newUID = $sth->fetchrow)
{
if ($in{'requestID'} == $newUID)
{
$currID = $newUID;
}
else
{
$prevID = $newUID;
}
... #there's a counter to generate one more loop after the currID is f
+ound, to capture "nextID"
$nextID = $newUID;
}
print p(["Previous = |$prevID|","Current = |$currID|","Next = |$nextID
+|"]);
so, if i submit the value 2 as 'requestID', the results for $prevID is correctly listed as 1, $currID is undefined, and $nextID gets assigned as 2. this is what it looks like:
0 #this is a counter value to escape the while loop after finding the
+value of $nextID
Previous = |1|
Current = ||
Next = ||
1
Previous = |1|
Current = ||
Next = |2|
it seems to me that the condition ($in{'requestID'} == $newUID) is not getting evaluated correctly, and i'm wondering if one of the other value is not recognized as an integer? is that the problem? how do i fix it? the database file is MySQL, and the UID field is defined as an integer field.
TIA,
janaki