I have a problem with the mysql_num_rows ()
"Warning: mysql_num_rows () expects parameter 1 to be resource, boolean given "
I've been browsing other posts but none could help me. PHP looks like this:
//Sistema de paginação
$sql_select_all = "SELECT id, nome, descricao, 'empresa' as empresa, 'empresa' as tipo
FROM tbl_empresa
WHERE id LIKE '%".$colname_Pesquisa."%' OR nome LIKE '%".$colname_Pesquisa."%' OR descricao LIKE '%".$colname_Pesquisa."%'
UNION ALL
SELECT tbl_produto.id, tbl_produto.nome, tbl_produto.descricao, tbl_empresa.nome, 'produto' as tipo
FROM tbl_produto
JOIN tbl_empresa
ON tbl_empresa.id = tbl_produto.tbl_empresa_id
WHERE tbl_produto.id LIKE '%".$colname_Pesquisa."%' OR tbl_produto.nome LIKE '%".$colname_Pesquisa."%' OR tbl_produto.descricao LIKE '%".$colname_Pesquisa."%'";
$sql_query_all = mysql_query($sql_select_all);
//O problema esta aqui
$total_registros = mysql_num_rows($sql_query_all);
I already checked the select and it is returning the expected value, so much it shows on the page.
Realized that
$total_registros
e
$sql_query_all
do not return anything to me;
The code is working perfectly on my localhost (PHP 5.3.0), but when I went to the server (PHP 5.3.29) it appeared that error. I do not think there's any difference between those versions that would impact that way.
If anyone can help me, I'll be grateful!