Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Pending help

  1. #1
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pending help

    mysql version: 5.0.81-community
    note exactly sure what it means by no variables? but here is code:
    Code:
    PHP Code:
    }else{
    $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)) {
    $ad=$rowz["offerid"];

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

    $iz=$registro["id"];

    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>
    </TR>
    <?
    }
    }
    }
    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.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    So you just need to join the two tables where the ids don't have a match.

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

  • #5
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Last edited by pdent1; 09-08-2009 at 10:39 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •