FRIHOSTFORUMSSEARCHFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

mysql/php help please

 


golles
how can I via a php command look how much tings are in a table?
Someone gave me a cool script and it is running fine now Smile but I want to show somewhere: "there are X users in the ranktracker.".
script: www.golles.frihost.net/KoC/TDO/ranks

I think it can easely be done by just looking how much rows there are in that table, but I'm not formiliar with mysql.
here is a screenshot of the database:

Hope someone can help me?


//golles
dandelion
It seems really simple task. Wink
(It counts number of rows in the ranktracker table)
Code:
<?
  $query = 'SELECT COUNT(*) FROM ranktracker';
  $result = mysql_query($query);
  $X = mysql_result($result, 0);
  echo "there are $X users in the ranktracker."
?>

or
Code:
<?
  $query = 'SELECT * FROM ranktracker';
  $result = mysql_query($query);
  $X = mysql_num_rows($result);
  echo "there are $X users in the ranktracker."
?>
golles
thanks I got it working now Very Happy Very Happy Very Happy
Code:
<?
  $query = 'SELECT * FROM ranks_static';
  $result = mysql_query($query);
  $X = mysql_num_rows($result);
  echo "there are $X users in the ranktracker."
?>


I had to change ranktracker to ranks_static


//golles
bladercity
dandelion wrote:
It seems really simple task. Wink
(It counts number of rows in the ranktracker table)
Code:
<?
  $query = 'SELECT COUNT(*) FROM ranktracker';
  $result = mysql_query($query);
  $X = mysql_result($result, 0);
  echo "there are $X users in the ranktracker."
?>

or
Code:
<?
  $query = 'SELECT * FROM ranktracker';
  $result = mysql_query($query);
  $X = mysql_num_rows($result);
  echo "there are $X users in the ranktracker."
?>


Really easy Smile
Related topics

PHP Help please
I am having alot of trouble with forms! Urgent help please!
MySQL, PHP and APACHE
Is mySQL/php in safe mode on Frihosting?
PLEASE HELP!!.......PLEASE

help please
Help please! I can't login to my blog admin panel
simple php problem, please help...
PHP and MySQL noob need help please!
PHP and Mysql Project. Help

mysql base error please help
mySQL set-up on Frihost help please
THIS IS DRIVING ME INSANE!! PLEASE HELP!
I need some help please!
PHP Mysql admin area? please help
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.