$query = mysql_query("SELECT `title`,
`url_title`
FROM `fastsearch`
WHERE `tags`
LIKE '%$q%'
LIMIT 5");
while ($row = mysql_fetch_assoc($query)) {
print_r($row);
}
- You misspelled
$query
in your example mysql_fetch_assoc()
will return a row each time it is called, andFALSE
when out of rows. Use that to your advantage, by assigning a variable to it in the condition. Within thewhile()
loop,$row
will be the current row.