I'm struggling here... never really done a SELECT more complicated than WHERE X="Y" before...
I've got two tables.
SUBSCRIPTIONS
DISTRIBUTORS
DISTRIBUTORS has the fields
ID NAME EXPIRATION
SUBSCRIPTIONS just has
ID
... where I record if a DISTRIBUTOR has signed up for a "subscription".
Now I need to figure out which distributors are also 'subscribers' and sort this by EXPIRATION (unix time stamp) putting the ones who expire first at the top.
Started with...
<?
// begin crappy code snippet
$sql = "SELECT * FROM SUBSCRIPTIONS";
$sql_result = mysql_query($sql,$connection) or die ("Couldn't execute query.");
while ($row=mysql_fetch_array($sql_result)) {
$id = $row["ID"];
// now I was gonna kludge another "select" in here
// and echo out the ID NAME and EXPIRATION
// looping through here 250 times select, echo, select, echo
// but this wouldn't be in the order i needed...
// end my crappy code snippet
}
?>
As you can see, I'm a rank amateur. I'd appreciate any help. I think I need to do a "join", but I'm not sure where to begin.
Any help would be appreciated.
--Mark