Showing how many rows in a table?

Codes here !

Moderators: egami, macek, gesf

Post Reply
User avatar
webwired
New php-forum User
New php-forum User
Posts: 26
Joined: Sat Nov 23, 2002 5:20 pm
Location: St. Louis, Missouri
Contact:

Sat Nov 23, 2002 5:27 pm

Here is the code I am trying to use to print the number of rows that are in a table, but as you are probably laughing right now, you can see that it isn't working... any help will be most appreciated.

<?php
include_once "ez_sql.php";
$query = dbase_numrecords
$result = mysql_query ($query);
print ("$result");
?>

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Sun Nov 24, 2002 3:46 am

Code: Select all

 <?php

$query = mysql_query("SELECT *FROM `sometable`")
$numrows=mysql_num_rows($query);
echo $numrows;

 ?>


another solution

Code: Select all

$query = "select count(*) from base";
$r=mysql_db_query($database,"$query");
$count = mysql_result($r,0,"count(*)");

User avatar
webwired
New php-forum User
New php-forum User
Posts: 26
Joined: Sat Nov 23, 2002 5:20 pm
Location: St. Louis, Missouri
Contact:

Sun Nov 24, 2002 9:43 am

This is the final functional code:

Code: Select all

    
    <?php
    include_once "ez_sql.php";
    $result = mysql_query("SELECT * FROM quickinfo");
    $num_rows = mysql_num_rows($result);
    echo "$num_rows Customers\n";
    ?>

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Mon Nov 25, 2002 2:11 am

YES

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests