![]() |
Numbering mysql rows
Hi,
I've got a very simple query I'm trying to count rows with. Code:
$strike = mysql_query("SELECT * FROM table WHERE when = '$now'"); The $now variable is set above the query and is calling information correctly. How can I go about counting rows where when=$now? Thanks! |
Your code is correct. Are you sure $now is set correctly?
try "SELECT COUNT(*) AS count FROM table WHERE when='". time()."' " |
oops. :)
I got it worked out. Thanks rake. Using the word "when" for a database field was a bad idea. Apparently it's reserved. I changed the name of that db field, and my queries to match it, and everything works like I expect. Thanks again. |
jolten you should use rakes exmample, counting any other way is less efficient!
|
I would but it doesn't seem to work.
|
you need to mysql_fetch_array as you would any other query and then use $result['count']
|
All times are GMT. The time now is 08:52 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|