Jump to content


Photo

Get total row number?


  • Please log in to reply
1 reply to this topic

#1 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 28 March 2006 - 02:23 PM

<?php
$sql="SELECT * FROM Test WHERE testid='$editid'";
$query=mysql_query($sql);
$row=mysql_fetch_array($query);
?>

how do i have $total as the total amount of rows in the database

EDIT BY OBER: PLEASE USE CODE TAGS TO POST CODE.
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 28 March 2006 - 02:28 PM

<?php
$total = mysql_num_rows($query);
?>

As a side note, your naming is confusing. Your "query" is actually a "result". Your "sql" is actually the "query".

Info: PHP Manual





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users