View Full Version : Pending help

09-08-2009, 08:18 PM
mysql version: 5.0.81-community
note exactly sure what it means by no variables? but here is code:

$ad_query = mysql_query("SELECT offerid FROM pendingoffers WHERE user='$user'") or die(mysql_error());
if (mysql_num_rows($ad_query)>0) {

while ($rowz = mysql_fetch_array($ad_query)) {

$tabla = mysql_query("SELECT * FROM offerads WHERE user!='$user' ORDER BY id ASC");
while ($registro = mysql_fetch_array($tabla)) {


if ($iz!=$ad){

echo "<TR>
<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px>". $registro["description"] ."</TD>
<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px><a href=\"". $registro["url"] ."/\" target=\"_blank\">". $registro["url"] ."</a></TD>
<TD NOWRAP ALIGN=LEFT CLASS=Style1 HEIGHT=0px>". $registro["value"] ."</TD>

<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px><form method="post" action="completeoffer.php?id=<?= $registro["id"] ?>"><input type="hidden" value="<?= $registro["user"] ?>" class="text" name="owner"><input type="submit" value="Complete" class="button"></form></TD>

No errors script works just not correctly.

Table for Offers
id, user, pemail, plan(basicly how many can be completed), url, description, ip, tipo, status

Table for PendingOffers
id, offerid(Logs ID from OFFER TABLE), user(you), owner(me), status, date, email

Output Error:
If PendingOffers offerid = 1 then it don't show offer=1 when i list offers, but if offerid=1 AND 3 is completed...it shows offer=1 again but not 3...

What I want:
I need it to not show any offers lets say it be 1-3-6-9 but show 2-4-5-7-8 that are listed in pendingOffers table under Offerid

I've attempted alot and just resorted to this as last resort. Only thing left to fix before I release website.

Hope that is all....If you need to know anything else feel free to reply with what you need i'll refresh every 20 minutes or so.

09-08-2009, 10:26 PM
You are using two queries when you should be able to achieve your goals with just one. Unfortunately it's not clear from your post what exactly you want to display. Forget for a moment your ids, just tell us what you want to see on the webpage.

09-08-2009, 10:34 PM
Alright I have a list of offers by ID Id1 offer1, Id2 Offer2, Id3 Offer3
If a customer completes offer1 and offer3 then it goes to table PendingOffers. I want the offer page to Hide Offer1 and offer3 since its listed on the pendingoffers table. The pendingoffers table has the username so if you need just use username='$user' I can edit it to fit my standards

09-08-2009, 10:44 PM
So you just need to join the two tables where the ids don't have a match.

FROM offers as o
JOIN pendingoffers as p
ON p.offerid != o.id
AND o.user = '$user'

09-08-2009, 11:37 PM
You are the MAN! Thanks, SOLVED. Thanks going to do research on joining tables and learn a little never had to do that before.Edit: Also forgot to mention got a fetch array error with o.user != $user not sure why but a simple if statement solved my problem. Thanks again