|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
What's the mysql code for counting the records in a table. I now have a php3 file with connect and select (it's all OK)
$records = mysql_numrows(mysql_query(SELECT * FROM penpals)); But this doesn't display the number of records in table "penpals". How could I do this? |
|
#2
|
|||
|
|||
|
Your function is wrong. The function is:
mysql_num_rows() Notice the additional underscore? Also, you need to place quotes around your query: $records = mysql_num_rows(mysql_query("SELECT * FROM penpals")); The following results in a quicker query and less memory usage: list($records)=mysql_fetch_row(mysql_query("select count(*) from penpals")); HTH |
|
#3
|
|||
|
|||
|
And what should be the whole php3 file with only a counter in it??? It doesn't work!
|
|
#4
|
|||
|
|||
|
do you mean:
print $result; ??? |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Counting records on php3 page... how? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|