Can anyone tell me what's wrong with this piece of code?
PHP is returning this warning: "Supplied argument is not a valid MySQL result resource ..." in the line with **
If I quote the first query, the code runs perfectly... I can't figure out what might be interfering with the second query...
$query_cat = mysql_query("SELECT nome FROM categorias WHERE id_categoria = $cat",$db);
$cat = mysql_fetch_assoc($query_cat);
echo "<b>".$cat["nome"]."</b><br><br>";
$query = mysql_query("SELECT * FROM subcategorias WHERE id_categoria = $cat",$db);
** if (mysql_num_rows($query)<1) { echo "<font size=\"1\">De momento não existem sub-categorias.</font><br><br>"; } **
elseif (mysql_num_rows($query)>=1) {
while ($subcat = mysql_fetch_array($query)) {
[...]
}