Number of Lines in Table. SOLVED
| From: | Ethan Rosenberg | Date: | Sun, 07 Sep 2014 04:12:55 +0000 |
| Subject: | Number of Lines in Table. SOLVED | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-48919@lists.php.net to get a copy of this message | ||
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) SELECT SQL_CALC_FOUND_ROWS itm FROM Purchases LIMIT 500 OFFSET 0; +------------------------------------------+
| itm |+------------------------------------------+
| BT-300. Host interface: USB | | Oregano | | Fancy Paprika | | Fancy Paprika || <snip>
| Oregano | | Oregano | | Oregano | | Oregano | | Basil |+------------------------------------------+ 453 rows in set (0.00 sec) mysql> SELECT FOUND_ROWS(); +--------------+ | FOUND_ROWS() | +--------------+
| 453 |+--------------+ 1 row in set (0.00 sec)
$sql26 = "SELECT SQL_CALC_FOUND_ROWS itm FROM Purchases LIMIT 50 OFFSET 0"; /*if (!mysqli_query($cxn, $sql26))This does not:
printf("Errormessage: %s\n", mysqli_error($cxn)); */
$result26 = mysqli_query($cxn, $sql26);
$sql27 = "SELECT FOUND_ROWS()";
/*if (!mysqli_query($cxn, $sql27))
printf("Errormessage: %s\n", mysqli_error($cxn));*/
$result27 = mysqli_query($cxn, $sql27);
$row27 = mysqli_fetch_row($result27);
print_r($row27);
//output
Array
(
[0] => 1 //is now the correct value.) What is my error? TIA Ethan --- Dear List - Thanks to all. Solved by commenting out the debugging line [see above]. Why?? TIA Ethan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php