but i can put it like that right?
got this error
Warning: Wrong parameter count for mysql_result() in /home/a5510829/public_html/mailing_list/signup.php on line 34
Curious thing happened...
I already had the counting working this way
$query = mysql_query("SELECT COUNT('user_id') FROM `users`"); // this is the query
$query = mysql_query("SELECT * FROM `users`"); // You can do this too, Selecting everything from users * = everything
$count = mysql_num_rows($query); // Assuming if you are counting users or something, mysql_num_rows() is the right function for it....
....
.....
......
<p>There are currently <strong><?php echo "$count"; ?></strong> registered user<?php echo $suffix; ?>.</p>
but I wanted to know if there was another way to do it
Using this method
function user_count() {
return mysql_result(mysql_query("SELECT COUNT(`user_id`) FROM `users`"));
}
....
.....
......
There are <?php echo "$user_count"; ?>
it doesn't work and also your suggestion didn't work either
but if I do it like this
//$query = mysql_query("SELECT COUNT('user_id') FROM `users`"); // this is the query
$query = mysql_query("SELECT * FROM `users`"); // You can do this too, Selecting everything from users * = everything
$count = mysql_num_rows($query); // Assuming if you are counting users or something, mysql_num_rows() is the right function for it....
function user_count() {
return mysql_result(mysql_query("SELECT COUNT(`user_id`) FROM `users`"));
}
....
.....
......
<p>There are currently <strong><?php echo "$count"; ?></strong> registered user<?php echo $suffix; ?>.</p>
There are <?php echo "$user_count"; ?>
they both show the same number of registered users.
Now I don't know why adding
$query = mysql_query("SELECT * FROM `users`");
$count = mysql_num_rows($query);
made thee two work :S