I've got a Perl program that is returning an incomplete result set. I can output the mySQL call that Perl is executing. In the perl program it gets less records back than if I copy and paste the statement into phpMyAdmin and execute it.
SELECT brand,name,collection,dept FROM models2 WHERE status < 8 && top <> '' && name <> 'home' && name <> 'Nappa Vitello Keyholder 6-Hook' and dept = 'LEATH' ORDER BY RAND() LIMIT 5
This statement returns 0 records when executing in PERL and returns 5 records when executed from within PhpMyAdmin!
Here's the code that is executing it.
$sql_stmt = "SELECT brand,name,collection,dept FROM models2 WHERE status < 8 && top <> ''".$model_exclude;
$sql_stmt.= " and dept = '$dept'" if ($dept);
$sql_stmt.= " ORDER BY RAND() LIMIT 5";
# print "<br><font size=1>$sql_stmt</font><br>";
$sth = $dbh->prepare ("$sql_stmt");
my $found = $sth->rows();
print "found $found<br>";