Jump to content

techiefreak05

Members
  • Posts

    494
  • Joined

  • Last visited

    Never

Posts posted by techiefreak05

  1. Here is my current code:

     

    <?php
    
    $query = "SELECT trade_offers.*, members2.username
            FROM trade_offers
            LEFT JOIN members2 ON trade_offers.user_id = members2.id
        WHERE trade_id = $_GET[tradeid]";
    
    $result = mysql_query($query) or DIE (mysql_error());
    
    while ($record = mysql_fetch_array($result)) {
    
            $username = $record['username'];
            echo "<h4>Offer made By: " . $record['username'] . "</h4>\n";
    
        echo "<img src=\"".$base_url."/images/user_images/opg_1/items/item_" . $record['item_id'] . ".gif\">\n";
    }
    ?>
    

     

    which shows "Offer made By:XXX" for every item offered, when it should only show "Offered made By:XXX" for the group of the items that the said person offered.

     

    EXAMPLE OUTPUT:

    when running the code from above, i actually get this exactly, except <item> is the image of the item.

    *****************************

    Offer made By: brenden

    <item>

     

    Offer made By: _test_

    <item>

     

    Offer made By: _test_

    <item>

     

    Offer made By: _test_

    <item>

     

    DESIRED OUTPUT:

     

    Offer made By: brenden

    <item>

     

    Offer made By: _test_

    <item> <item> <item>

     

     

    See how all te items are grouped by the person who offered them?

  2. @akitchin:

    your query did not work at alll..

     

    @mjdamato:

    yours worked perfectly! ONLY ... if each person ofers only ONE item, but multiple are allowed...so if i offered you 2 items.. it shows one at the top of the page.. and the other one, under "Offer made By: techiefreak05"... but like I said its fine if there is only one item offered per person... so, how can we fix it?

  3. im developing aan "item trade system" for a client of mine, and everything up to this point has worked, but the page where you view the offers of the trade, is very strage, but I know i thas something to do with my "while" loops. it only shows the last offer, when it should show them al and organize them by user. right now the database is setup , that when people make an offer, each seperate item is placed in the "trade_offers" table, with the "item_id" and "user_id" ... the following code should work, and it does... but it only shows the LATEST offer ...

    <?php
    //GET USER ID#'s OF ALL OFFERERS
    $query1 = mysql_query("SELECT * FROM trade_offers WHERE trade_id = $_GET[tradeid]") or die(mysql_error());
    while ($array1 = mysql_fetch_array($query1)){
    $u__id = $array1[user_id];
    }
    
    //RETREIEVE USERNAMES FOR DISPLAY PURPOSES ONLY
    $query3 = mysql_query("SELECT * FROM members2 WHERE id = $u__id") or die(mysql_error());
    while ($array3 = mysql_fetch_array($query3)){
    $offerer_Name =  $array3[username];
    echo "<h4>Offer made By: $offerer_Name</h4>";
    }
    
    ///GET THE ITEMS OF EACH PERSON WHO MADE AN OFFER
    $query2 = mysql_query("SELECT * FROM trade_offers WHERE trade_id = $_GET[tradeid] AND user_id = $u__id") or die(mysql_error());
    while ($array2 = mysql_fetch_array($query2)){
    $item__id =  $array2[item_id];
    ?>
    <img src=<?php echo $base_url; ?>/images/user_images/opg_1/items/item_<?php echo $item__id;?>.gif>
    <?php
    }
    ?>
    

     

    Thanks a lot in advance!!

  4. i dont think this error means he doesnt have php installed, if he didnt, he wouldnt get a 500 erro. it would just show the page, with the code, just like my host does not have ColdFusion installed, so if try to run a .cfm file, it just shows the whole source without executing any code.

  5. I'm creating a trading system for my friends pet site, and its sll going well, until you view the offers on a trade, even when there are more offers made, it only shows the latest one...heres the code

     

    <?php
    $query1 = mysql_query("SELECT * FROM trade_offers WHERE trade_id = $_GET[tradeid]") or die(mysql_error());
    
    while ($array1 = mysql_fetch_array($query1)){
    $u__id = $array1[user_id];
    
    
    
    
    
    $query3 = mysql_query("SELECT * FROM members2 WHERE id = $u__id") or die(mysql_error());
    
    while ($array3 = mysql_fetch_array($query3)){
    $offerer_Name =  $array3[username];
    }
    
    
    
    
    
    }
    
    $query2 = mysql_query("SELECT * FROM trade_offers WHERE trade_id = $_GET[tradeid] AND user_id = $u__id") or die(mysql_error());
    
    while ($array2 = mysql_fetch_array($query2)){
    $item__id =  $array2[item_id];
    }
    ?>
    
    
    
    
    <h4>Offer made By: <?php echo $offerer_Name; ?></h4>
    <img src=<?php echo $base_url; ?>/images/user_images/opg_1/items/item_<?php echo $item__id;?>.gif>

  6. I use this rewrite rule to automatically add the "www" in front of my domain...

     

        
    RewriteCond %{HTTP_HOST} !^www\.site\.com$ [NC]
       RewriteRule .? http://www.site.com%{REQUEST_URI} [R=301,L]
    

     

    .. I have loads and loads of RewriteRules .... I have the url http://www.site.com/users/1 to show a users profile... but if I go to..notice the NO "www".... http://site.com/users/1 it ends up showing "http://www.site.com/users/1?id=1" in the URL! because the "/users/#" RewriteRule shows "/userProfs/?id=#" so going to http://www.site.com/users/1 is the same as going to http://www.site.com/userProfs/?id=1 ... but it ADS the ?id=1 to the re-written URL if i dont have the "www" in front.... any ideas!?

     

    BASICALLY:

    ... going here: http://site.com/users/1

    rewrite's to http://www.site.com/users/1?id=1 when it SHOULD rewrite to http://www.site.com/users/1

  7. I am running WAMP Server on my computer, and I need to run a script with the PHP Command Line Interface... I've been doing some research and  so I tried entering the folowing command into the php command window: php -h, that is supposed to show a list of commands... nut it does nothing... nothing I try works... any ideas?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.