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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.