Jump to content

Mysql_fetch_array error on Select query


turpentyne

Recommended Posts

I'm trying to figure out some pagination on a left joined query, and not having any luck. The query seems to be pulling the entire database, so I went into the query's WHERE and added the table name "descriptors." Now I'm getting this error with the below query: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /data/21/2/40/160/2040975/user/2235577/htdocs/leafsearch4.php on line 35

 

also: Unknown column 'descriptors.leaf_shape' in 'where clause'

I thought this was syntax, but maybe I'm missing something.

 

$query = "SELECT COUNT(*) as num 
                    FROM
                        descriptors
                    LEFT JOIN
                        plantae ON (descriptors.plant_id = plantae.plant_name)
                    WHERE
                        `descriptors.leaf_shape` LIKE '%$select1%'
                        AND `descriptors.leaf_venation` LIKE '%$select3%'
                        AND `descriptors.leaf_margin` LIKE '%$select4%'";

$total_pages = mysql_fetch_array(mysql_query($query));

Link to comment
https://forums.phpfreaks.com/topic/212330-mysql_fetch_array-error-on-select-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.