My query works fine, except it does not return all the results that I can plainly see exist in the table:
If I remove the "AND (Approved LIKE 'y')" section then it works perfectly. As it is, it may return one row when two rows meet the conditions. With the AND line gone, it will return both rows. Yet a double-check shows both rows have the same $name and y in their respective fields. I don't get any error messages.PHP Code:$namesql = mysql_query
("SELECT ID, ModelName, OwnerName, Approved, Thumb, Date
FROM racerspotlight
WHERE (ModelName LIKE '$name') AND (Approved LIKE 'y')
ORDER BY Date DESC
");
I need the Approved field so I can accept reader uploads, then I'll change the value from default "n" to "y" if the upload is appropriate.
The $name is a POST from another page. Here's the code just above the top code:
Thanks,PHP Code:if (isset($_POST['name']))
{
$name = $_POST['name'];
$name = strip_tags($name); // REMOVE SYMBOLS
$name = trim($name); // REMOVE ANY EXTRA WHITE SPACE AT END OF LINE
$name = htmlspecialchars($name);
}
Steve





Bookmarks