hi, all,i having code as below and the output is in the picture below as well

<?php require_once("includes/session.php"); ?>
<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php confirm_logged_in(); ?>
<?php find_selected_item(); ?>
<?php include("includes/header.php"); ?>
<table id="structure">
        <div class="menu">
                <?php echo navigation($sel_cat, $sel_item); ?>
        <td id="item">
                $row_number = mysql_query("SELECT * FROM items");
                $num_rows = mysql_num_rows($row_number);
                $check =$_SESSION['username'];
                $query = "SELECT id, winner, item_status ";
                $query .= "FROM items ";
                $query .= "WHERE winner = '{$check}' ";
                $query .= "LIMIT 1";
                $result_set = mysql_query($query);

                if (mysql_num_rows($result_set) == 1){
                    $result = mysql_query("SELECT * FROM items WHERE winner='$check'");

                    //-count results
                    echo "you currently have "  .$numrows . " items purchased. \n";

                    //-create while loop and loop through result set
                        $seller =$row['seller_name'];
                        $_SESSION['item_id'] = $ID;
                        $_SESSION['item_name'] = $item;
                        $_SESSION['current_bidding_price'] = $current_bidding_price;
                        $_SESSION['seller'] = $seller;
                        $check1 = 0 ;

                        //-display the result of the array
                        echo "<ul>\n"; 
                        echo "" . "<a href=\"index.php?item=$ID\">"  .$item . "</a>\n";
                        if($item_status ==0){
                            echo "" . "<a href=\"sellerdetail.php\">"  ."<input type=\"submit\" value=\"Pay Now\" >". "</a>\n";
                        } else {
                            echo "" . "<a href=\"index.php?item=$ID\">"  ."<input type=\"submit\" value=\"CHECK\" >". "</a>\n";
                        echo "</ul>";
                        $NULL = null;

                } else {
                    echo "you not won/purchased anything currently";
<?php require("includes/footer.php"); ?>


for now i have 2 result, but if i choose the item "diamond" ,the session passed the "iphone4 by kokfui" to new php, i think this is because the looping have cleared the "diamond" information, anyone can help me solve this??thank you very much

certainly session don’t pass wrong id (it has nothing against you and will pass what ever you give). I would recommend reading any PHP tutorial don’t try to go to a stage when you don’t know the basics of a previous one.

Member Avatar


Try using code tags [ CODE ]

You'll get more replies.

You havnt using the session_start(); at the top pf your script.How can you passing your session variable?