I see. Ok thanks Matt. Will look into that if I start working with those size databases. My apology Ethan, wasn't aware of the scope. Best, Karl DeSaulniers Design Drumm http://designdrumm.com On Sep 3, 2014, at 12:09 AM, Matt Pelmear <mjpelmear@xxxxxxxxx> wrote: > Karl, > > This works for small datasets, but when you have a large amount of data (either in terms of storage or row count) it is no longer practical. > This is why people typically use the SQL row count instead of transferring all of the data to php and doing the work there. It is much more efficient. > (You may wish to read about buffered vs unbuffered queries) > > Matt > > On Sep 2, 2014 9:57 PM, "Karl DeSaulniers" <karl@xxxxxxxxxxxxxxx> wrote: > On Sep 2, 2014, at 9:37 PM, Ethan Rosenberg <erosenberg@xxxxxxxxxxxxxxxxxxxx> wrote: > > > Dear List - > > > > This works: > > > > mysql> describe Purchases; > > +-------+-------------+------+-----+---------+----------------+ > > | Field | Type | Null | Key | Default | Extra | > > +-------+-------------+------+-----+---------+----------------+ > > | indx | smallint(6) | NO | PRI | NULL | auto_increment | > > | manf | varchar(20) | YES | | NULL | | > > | itm | varchar(50) | YES | | NULL | | > > | prc | float | YES | | NULL | | > > +-------+-------------+------+-----+---------+----------------+ > > 4 rows in set (0.00 sec) > > > > What is my error? > > > > TIA > > > > Ethan > > Hi Ethan, > Is it terribly important for you to get the count from MySQL? > Php does a nice job of this very easily. > > $sql = "SELECT itm FROM Purchases"; > > $result = mysqli_query($cxn, $sql); > > if (!mysqli_query($cxn, $sql27)) > printf("Errormessage: %s\n", mysqli_error($cxn)); > > if(!$result || (mysql_numrows($result) < 1)){ > return NULL; > } > /* Return result array */ > $rowarray = mysqli_fetch_array($result); > $numrows = count($rowarray); > > //return $rowarray; > > print_r('Number of rows: '.$numrows); > print_r('Results { '.$row.' }'); > > Haven't tested this, but I believe it should work out the box. May need to tweek to taste. > HTH, > > Best, > > Karl DeSaulniers > Design Drumm > http://designdrumm.com > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >