我运行查询时在mysql中收到以下错误

时间:2012-01-25 17:46:39

标签: php mysql

  

可能重复:
  mysql_fetch_array() expects parameter 1 to be resource, boolean given in select

$username="root";
$password="webmaster";
$database="demo1";
mysql_connect("localhost","root","webmaster");
@mysql_select_db($database) or die( "Unable to select database");
/*query the database*/
$query = "select field1_name, field2_name, field3_name, field4_name, 
                 field5_name, field6_name, field7_name, field8_name,
                 field9_name, field10_name, field11_name, field12_name,
                 field13_name, image, fieldl1_name, fieldl2_name,
                 fieldl3_name, fieldl4_name, fieldl5_name, fieldl6_name,
                 fieldl7_name
           from tablenamevehicle 
           full join members on members.member_id=tablenamevehicle.field13_name 
           where field4_name like '%".$searchterm4."%' 
             and field5_name like '%".$searchterm5."%'
             and field1_name like '%".$searchterm1."%'
             and field2_name like '%".$searchterm2."%'";

$result = mysql_query($query);
/*number of rows found*/
$num = mysql_numrows($result);

mysql_close();

我得到的错误是:

Warning: mysql_numrows() expects parameter 1 to be resource, boolean given in 
F:\xampp\htdocs\xampp\Login1\vehicle\search.php on line 171

查询中有什么问题???

2 个答案:

答案 0 :(得分:3)

FULL JOIN不是你在MySQL中可以做的事情(见12.2.8.2. JOIN Syntax)。您可以通过检查mysql_error()

来确认这一点

您可能需要INNER JOINCROSS JOIN

答案 1 :(得分:0)

假设两个连接列的数据类型与此透视图中的命名约定相同,否则SQL看起来很好。

members.member_id=tablenamevehicle.field13_name

我也看不到您在哪里定义搜索字词...