Jump to content

Filtering a Recordset by another recordset


anshugiri

Recommended Posts

hi, i am trying to filter a recordset using another recordset

 

i tried

$query_Recordset1 = "SELECT * FROM wayra_gallery WHERE img_albumname = $row_rs_albums['gallery_alb_name']";

 

here rs_albums is another recordset that exists:

recordset1 is the one i am trying to create

 

what is the mistake...and how can i correct it

 

thanks

You haven't really given enough detail to expect a correct solution to your problem.  Assuming the $row_rs_albums['gallery_alb_name'] array element contains a valid numeric value, then the only wrong with the query, syntactically, is the use of single quotes around the element key within the double quotes.  However, if the img_albumname is a VARCHAR (or similarly string-based), then you should be quoting the value.

 

$query_Recordset1 = "SELECT * FROM wayra_gallery WHERE img_albumname = '$row_rs_albums[gallery_alb_name]'";

// or 

$query_Recordset1 = "SELECT * FROM wayra_gallery WHERE img_albumname = '{$row_rs_albums['gallery_alb_name']}'";

 

You should have looked for and posted errors pertaining to this issue if you had any.

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.