0
$qrysc = "select * from `communities` where `name` like \"%$key%\" or `type` like \"%$key%\" or `about` like \"%$key%\" union all select * from `personal` where `fname` like \"%$key%\" or `lname` like \"%$key%\" or `country` like \"%$key%\"  or `state` like \"%$key%\"  or `city` like \"%$key%\"";
$rqrysc=mysql_query($qrysc);
$numqrysc=mysql_num_rows($rqrysc);

Here communities and personal are two different tables on the same database. I am trying to search in both tables to generate output depending on the result found. I am getting error
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in F:\WORK STATION\xampplite\htdocs\GlobalDost\search\sprocess.php on line 10

line 10 is

$numqrysc=mysql_num_rows($rqrysc);

. Please tell me what's wrong or suggest me something else to achieve my goal.

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by pratik_garg
0

1. create a view based on desired columns of both the tables
2. concatenate all the columns into a single column in the view.
3. search on the view

0

HI sakush100,

while appling union with two table you should have same data type in column order

so you have to check your data table structures first ....
this could be a problem....

please paste here structures of these tables here..


see php : mysql_query
if this function fails it will return false (boolean).

thats why you are getting error, because this has failed and expected result set "$rqrysc" which is now a boolean "false" we are giving to mysql_num_rows() function.

so check this out.........

Edited by pratik_garg: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.