Web Analytics Made Easy -
StatCounter PHP Help? Displaying Results - CodingForum

Announcement

Collapse
No announcement yet.

PHP Help? Displaying Results

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP Help? Displaying Results

    Alright I am displaying information from an excel spreadsheet from a database through MySQL, someone else set it up for me with the code. They put it to where it only displays 11 names of the 500+ on the spreadsheet, I need to know how I can display all of the names not just 11 of them... heres the code:

    Code:
    <?php
               $designation = ($_GET['designation']);
               $year = ($_GET['year']);
               echo $designation;
               echo "&nbsp;";
               echo $year;  
       
               if ($designation == 1) {// had to make sure to use == instead of = here
        $query = "SELECT * FROM members WHERE designation = $designation AND iYear = $year ORDER BY fullName ASC LIMIT 0, 600";
         
      
       
        } else if ($designation == 0 ) {// had to make sure to use == instead of = here
         
        $query = "SELECT * FROM members WHERE designation = $designation AND hYear = $year ORDER BY fullName ASC LIMIT 0, 600";
         
       
        }
        $result = @mysql_query($query);
        if ($result) {
            echo '<table align=\"left\" cellspacing=\"0\" cellpadding=\"5\" border=\"1\">';
            while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
                echo "<tr><td align=\"left\" valign=\"top\"><a href=\"member_detail.php?ID=$row[0]\">►&nbsp;$row[1]&nbsp; $row[3]</a>";
                echo "</td></tr>\n";
           
            } echo '</table>';
        }
        ?>

  • #2
    The SQL query is only getting records that match the WHERE clause.
    Code:
    SELECT * FROM members 
    WHERE designation = $designation AND hYear = $year 
    ORDER BY fullName ASC 
    LIMIT 0, 600
    That is, only those records that match the given $designation (a value from PHP) and $year (ditto).

    In addition, the LIMIT will only give you the first 600 matches.

    If you don't want the "filters" on $designation and $year, remove the WHERE clause.

    If you don't want to limit it to 600 records, remove the LIMIT clause.
    Code:
    SELECT * FROM members 
    ORDER BY fullName ASC
    Be yourself. No one else is as qualified.

    Comment

    Working...
    X