www.webdeveloper.com
Results 1 to 6 of 6

Thread: sql on limit pages

  1. #1
    Join Date
    Apr 2006
    Posts
    21

    sql on limit pages

    Hye, im newbie.

    please somebody help me on this?

    <?php if(!isset($_GET['page'])){
    $page = 1;
    } else {
    $page = $_GET['page'];
    }

    $max_results = 4;

    $from = (($page * $max_results) - $max_results);

    // this is my sql - i think im stuck at where statement.i can run
    // the script without 'where' but i need to include
    // where where A.teamID = B.teamID AND B.username = '" .
    // $HTTP_SESSION_VARS ["username"] . "'
    // but i dunno how..
    $sql = mysql_query("select taskID,name,status,variance,priority,percentage,duedate,assigned from task where A.teamID = B.teamID AND B.username = '" . $HTTP_SESSION_VARS ["username"] . "' ORDER BY A.taskID LIMIT $from, $max_results ");
    $name = $row['name']."<br />";

    while($row = mysql_fetch_array($sql)){
    $msg="
    <table width=\"98%\" border=0 align=\"center\"><tr bgcolor=\"#FFFFFF\">
    <td><font size=2 face=\"Tahoma\"><b>$name</a></font></td>
    <td align=\"center\"><font size=1 face=\"Verdana, Arial, Helvetica, sans-serif\">$status </font></td>
    <td align=\"center\"><font size=1 face=\"Verdana, Arial, Helvetica, sans-serif\">$variance</font></td>
    <td align=\"center\"><font size=1 face=\"Verdana, Arial, Helvetica, sans-serif\">$priority</font></td>
    <td align=\"center\"><font size=1 face=\"Verdana, Arial, Helvetica, sans-serif\">$percent</font></td>
    <td align=\"center\"><font size=1 face=\"Verdana, Arial, Helvetica, sans-serif\">$duedate</font></td>
    <td align=\"center\"><font size=1 face=\"Verdana, Arial, Helvetica, sans-serif\">$assigned</font></td>
    </tr>";
    }
    $msg.="</table>";

    ?>


    thank you so much...

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,633
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Oct 2005
    Location
    California
    Posts
    603
    PHP Code:
    if(!isset($_GET['page'])){
         
    $page 1;

    else 
    {
         
    $page $_GET['page'];

    What is returned when you echo $page? Is it different than you expected? Consider this... if page does not = 1, you still run the rest of your script. I'm thinking that's not what you want to do.

    Also, the second part of that if statement doesn't mean anything. You're trying to pass a variable that is not set to another variable.

  4. #4
    Join Date
    Apr 2006
    Posts
    21
    thank you for your reply sitehatchery..
    i juz get the coding from the internet..
    so im not clear about that..

    what should i do next?

  5. #5
    Join Date
    Apr 2006
    Posts
    21
    btw..thanx all.. ive already solved it by myself

  6. #6
    Join Date
    Oct 2005
    Location
    California
    Posts
    603
    Well, there are a lot of things. First, $name = $row['name'] is used before your while loop. Then, you are using variables that have no value. I think you mean to use $row['status'], $row['variance'], etc.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles