Right, basically I have 2 tables. History, and ads. I need to know how I go about selecting all the adid's from History and then selecting a random 'adid' from 'ads' that doesn't have a adid that is in the History table. Will try explain a little better, so basically I need to get a random row from the 'ads' table that hasn't already been added to the history table. Please post if you don't get what I mean, I'll try explain again a bit differently!
I've tried using mysql_fetch_array to get a array of data from the history table and then selecting from ads where 'adid' doesn't equal $adid. Like below...
$q2 = mysql_query("SELECT * FROM clickhistory");
$r2 = mysql_fetch_array($q2);
$ads = $r2['adid'];
$q3 = mysql_query("SELECT * FROM ads WHERE adid != '$ads'");
$r3 = mysql_fetch_array($q3);
I'm pretty tired so may have missed something, or this might be the total wrong way, I've just never had to do anything like this before! Code above is just a re-written example not the actual code!
Thanks in advance for any help!


Sign In
Create Account


Back to top









