iDisplay Limit User Variable

Chris Morgan cmorgan at alum.wpi.edu
Mon Feb 20 20:21:35 CST 2006


> ===================================================================
> RCS file: /home/wine/appdb/include/testResults.php,v
> retrieving revision 1.9
> diff -U3 -r1.9 testResults.php
> --- testResults.php    28 Jan 2006 22:53:28 -0000    1.9
> +++ testResults.php    20 Feb 2006 16:42:15 -0000
> @@ -349,23 +349,24 @@
>      // Show the Test results for a application version
>      function ShowVersionsTestingTable($iVersionId, $iCurrentTest, $link,
> $iDisplayLimit)
>      {
> -        $showAll = $_REQUEST['showAll'];
> +
> +    if(!$iDisplayLimit) {
> +        $iDisplayLimit = 5;
> +    }

iDisplayLimit is passed into this function, why check it for being undefined 
or 0?

>
> -        $sQuery = "SELECT *
> +    $sQuery = "SELECT *
>                     FROM testResults
>                     WHERE versionId = '".$iVersionId."'
>                     ORDER BY testedDate DESC";
> -
> -        if(!$showAll)
> -            $sQuery.=" LIMIT 0,".$iDisplayLimit;
> -
> -        $hResult = query_appdb($sQuery);
> -        if(!$hResult)
> -            return;
> -
> -        $rowsUsed = mysql_num_rows($hResult);
> +    if($iDisplayLimit !== "ALL") {

$iDisplayLimit is an integer, as defined by the 'i' that proceeds the name.  
Why compare it to the string "ALL"  and why !== instead of != ?


> +        echo 'Tests:<select name="iDisplayLimit">';
> +        for($iCounter=5; $iCounter<=20; $iCounter=$iCounter+5) {

You should probably pass the iCounter limit and increment into the function 
instead of hardcoding them.

Chris



More information about the wine-patches mailing list