Problems with displaying results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have two queries one pulls out which users to use and the second pulls
those users orders....
Looks something like this but is only pulling the first record:


    $query =  "SELECT `UserName`, `AdminID` FROM admin
      WHERE   Key1 =  'YES' ";

    $result = mysql_query ($query) ;
    $row = mysql_fetch_assoc($result);

    //Reveal Variables for Debugging
    // include("VariableReveal2.php");
     echo ("Hello <br>");
    //echo $row['AdminID'];
    echo ($row['UserName']);




    if ($row['Key1'] == "NO") {
        header ("Location: Welcome.php?AdminID=$AdminID&msg=Sorry, you do
not have access to that page.");
    }

if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
'WorkOrderID DESC';}
if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}

$PerPage = 30;
$StartPage = ($Page - 1) * $PerPage;

        second query here is using the $row from the first (and yes I know
not to use *, just did so here to keep post shorter)

         $sql= "SELECT * FROM workorders WHERE AdminID =
'".$row['AdminID']."' ";
      // $sql .= "ORDER BY $SortBy LIMIT $StartPage, $PerPage";
      $result = mysql_query ($sql);
      $row2 = mysql_fetch_assoc($result);
      $Total = ceil(mysql_num_rows($result)/$PerPage);


    So this works but only half way as it only displays the first record in
the table.




Thanks
Terion

Happy Freecycling
Free the List !!
www.freecycle.org
Over Moderation of Freecycle List Prevents Post Timeliness.
------------------------------------------------
Twitter?
http://twitter.com/terionmiller
------------------------------------------------
Facebook:
<a href="http://www.facebook.com/people/Terion-Miller/1542024891";
title="Terion Miller's Facebook profile" target=_TOP><img src="
http://badge.facebook.com/badge/1542024891.237.919247960.png"; border=0
alt="Terion Miller's Facebook profile"></a>
Groucho Marx  - "I have had a perfectly wonderful evening, but this wasn't
it."

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux