mysql select num 1,mysql_num_rows()期望参数1为资源,布尔值在

I'm new in this forum.

I'm building a search within my site.

I have a problem with the DB. It's giving me this:

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\Program Files (x86)\EasyPHP-5.3.5.0\www\searchscript\search.php on line 86

I'll show you the code section where it gives me such error

line 82: $query = "SELECT * FROM dreams WHERE titolo,titch LIKE \"%$trimmed%\" ORDER BY id_dreams DESC ";

line 85: $numresults=mysql_query($query);

line 86: $numrows=mysql_num_rows($numresults); //error

Now I tried to see what is the problem behind the query and it's telling me this:

SELECT * FROM dreams WHERE titolo, titch LIKE "%tags%" ORDER BY id_dreams DESC

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'titch LIKE "%tags%" ORDER BY id_dreams DESC' at line 1

The code behind this is:

$query = "SELECT * FROM dreams WHERE titolo, titch LIKE \"%$trimmed%\" ORDER BY id_dreams DESC ";

$result = mysql_query($query) or die($query."
".mysql_error());

解决方案

The mysql_query is returning a boolean value meaning the sql query is probably failing and you're getting a false returned rather than a mysql resource.

Have you checked your query?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值