Hello:
I'm trying to select specific data from code 2 below, using the variable $clientID queried from code 1 (also below). The question is if code 1 iterates a series of rows containing variables $clientID (say about 10 unique $clientID's); how can I write code 2 to go through each of those unique $clientID's outputted from code 1?
here are the codes:
//code 1 (iteration )
$SQL = "SELECT clientID FROM additional_cars group by clientID";
$r = mysql_query($SQL);
while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) {
$clientID=$row['clientID'];
}
//code 2
$get_swork = "select servicearea, date, customerid, clientID from servicesrendered where servicearea=' Oil Change ' and clientID='$clientID' order by id desc limit 1";
$get_swork_res = mysql_query($get_swork);
if (mysql_num_rows($get_swork_res) > 0)
{
while ( $swork_info = mysql_fetch_array($get_swork_res))
{
$servicearea = $swork_info['servicearea'];
$date = $swork_info['date'];
$customerid = $swork_info['customerid'];
$clientID = $swork_info['clientID'];
}
}
Basically, my entire task (which includes more codes than presented here is to go through a series of tables, looking for the existence of certain variables and if true, prepare and send an email.
The question posed above, initiates the first process by checking tables with a where conditional statement.
I hope I'm explaining the task properly!
Any thoughts is appreciated!
Mossa