Re: [PHP] Counting Occurrences within an If statement



If it's a simple x < y, you might want to consider putting your if
statement in the SQL query so you don't return so many rows. To make a
counter, just set a variable like:
$counter = 0;

if ($x <$y)
{
print $row;
$counter++
}

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Mark Bomgardner wrote:
I have been working on the something for the last day and can't figure it
out.



I am pulling 7500 rows from a MySQL database, but I only want to display a
certain numbers of rows based up an if statement. I want to count the rows
within the if statement.



mysql query result



if(x < y){

display a row in a table

}else{

Don't display anything

}



Every time a row is displayed, I want to add one to a counter



markb



.



Relevant Pages

  • Re: Combo box question
    ... Rowsource to "table.field1, field2" ... If you don't want to display the id field, set the width of that column to ... can use it in your sql query. ...
    (microsoft.public.fox.vfp.forms)
  • Performing an SQL query in VBA
    ... I need to perform a SQL query in VBA and display the result in a ... txtLName_Changeevent and display the result in txtNum. ... just getting it to a textbox is great. ...
    (microsoft.public.access.gettingstarted)
  • Counting Occurrences within an If statement
    ... I am pulling 7500 rows from a MySQL database, but I only want to display a ... mysql query result ... display a row in a table ...
    (php.general)
  • Re: SQL query: how can I hide a column in output?
    ... I've the following SQL query: ... Actually, I need the alias client_no for further processing, but I ... You are not required to show that column, but your SELECT clause needs to show at least one column. ... If you are writing your own application, you do not have to display the column's value in that application if you do not want to. ...
    (comp.databases.oracle.server)
  • Excel Spreadsheet Object - Maximum Amount of Data
    ... I am using an excel spreadsheet object on a web page to display the ... results of a SQL query to my users. ... amount of data these objects can hold? ...
    (microsoft.public.office.developer.web.components)