Forum Moderators: coopster
I have a bit of a problem, and I know it's simple, but today I just can't seem to get around it, so I need some help!
Here is what I am trying to do with MySQL and PHP:
I'm running one query to get a certain number of fields returned. Here is the code in php:
$User_Services = mysql_query("SELECT DISTINCT `service_id` FROM `user_service_instance` WHERE `user_id` = '"$USERID"' ") or die(mysql_error());
Now, this can give me multiple results, and what I want to do is use each of this results in ONE more query to get what I'm after, for instance:
$GRPS = mysql_query("SELECT DISTINCT `group` from `services_and_groups` WHERE `service_id` != 'RESULT 1 FROM ABOVE` AND `service_id` != 'RESULT 2 FROM ABOVE'")... and so on so forth;
So, irrespective of how many results my first query gives, I want to be able to use all of those in one query. Is there any way i can append them to a variable with commas and then explode them and reuse them in the next query?
Thanks folks!