Number of Lines in Table.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)

>>>This does not:

$sql26 = "SELECT SQL_CALC_FOUND_ROWS itm FROM Purchases LIMIT 50 OFFSET 0";

if (!mysqli_query($cxn, $sql26))
    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
)

What is my error?

TIA

Ethan




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux