[PHP] Paging / Navigation Help

2002-12-12 Thread William Martell
Hello ALL.

Can anyone tell me why the number of rows is always 1 and count is the total
number of records in my database.

Thanks in Advance,
William

[snip]

HTML
HEAD
TITLE/TITLE
/HEAD

BODY

?php


 $db = mysql_connect(localhost, root);

 mysql_select_db(dallas, $db);

 $result =  mysql_query(SELECT COUNT(*) as count FROM partscatalog having
count 0;,$db);

 //get number of rows returned
 $number_of_rows = mysql_num_rows($result);

 if ($number_of_rows != '0')
  {
 while ($myrow = mysql_fetch_array($result))
   {
  echo \$number_of_rows is $number_of_rows;
 echo count: .$myrow[count].br\n;

 }
}

?

/body
/html


[/snip]


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




Re: [PHP] Paging / Navigation Help

2002-12-12 Thread 1LT John W. Holmes
Ummm... because that's exactly what you're asking for. Look over your code
again. COUNT(*) returns one record in one column, one row.

---John Holmes...

- Original Message -
From: William Martell [EMAIL PROTECTED]
To: phplist [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED] [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, December 12, 2002 2:56 PM
Subject: [PHP] Paging / Navigation Help


 Hello ALL.

 Can anyone tell me why the number of rows is always 1 and count is the
total
 number of records in my database.

 Thanks in Advance,
 William

 [snip]

 HTML
 HEAD
 TITLE/TITLE
 /HEAD

 BODY

 ?php


  $db = mysql_connect(localhost, root);

  mysql_select_db(dallas, $db);

  $result =  mysql_query(SELECT COUNT(*) as count FROM partscatalog having
 count 0;,$db);

  //get number of rows returned
  $number_of_rows = mysql_num_rows($result);

  if ($number_of_rows != '0')
   {
  while ($myrow = mysql_fetch_array($result))
{
   echo \$number_of_rows is $number_of_rows;
  echo count: .$myrow[count].br\n;

  }
 }

 ?

 /body
 /html


 [/snip]


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



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