This is a discussion on newbie : trying to count records in mysql table within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Help, I get no output on this code // Connect to database. $dbh = mysql_connect("localhost","user","...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Help, I get no output on this code
// Connect to database. $dbh = mysql_connect("localhost","user","password"); mysql_select_db("survey"); $query = "select count(*) from response1"; $result = mysql_query($query, $dbh); while ($rows = mysql_fetch_row($result)) { $count = $rows[0]; } print $count; any one have any Ideas ? Thanks in advance Jim |
|
|||
|
try this....
// Connect to database. > $dbh = mysql_connect("localhost","user","password"); > mysql_select_db("survey"); > > $query = "select count(*) AS rec_count from response1"; > $result = mysql_query($query, $dbh); > > while ($rows = mysql_fetch_row($result)) { > $count = $rows['rec_count']; > } > > > print $count; Haven't tried it..... hope tis helps... point "jim" <luvkatz@tds.net> wrote in message news:p78sgv8rg85e9t7940qpeu86vpe95mp5oq@4ax.com... > Help, I get no output on this code > > // Connect to database. > $dbh = mysql_connect("localhost","user","password"); > mysql_select_db("survey"); > > $query = "select count(*) from response1"; > $result = mysql_query($query, $dbh); > > while ($rows = mysql_fetch_row($result)) { > $count = $rows[0]; > } > > > print $count; > > > > > > > > any one have any Ideas ? > > Thanks in advance > Jim > > |
![]() |
| Thread Tools | |
| Display Modes | |
|
|