Re: Number of Lines in Table.

From: Date: Wed, 03 Sep 2014 04:57:13 +0000
Subject: Re: Number of Lines in Table.
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-48914@lists.php.net to get a copy of this message
On Sep 2, 2014, at 9:37 PM, Ethan Rosenberg <erosenberg@hygeiabiomedical.com> 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

« previous php.db (#48914) next »