The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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'"); $per = mysql_num_rows($strike); The $now variable is set above the query and is calling information correctly. How can I go about counting rows where when=$now? Thanks! |
#2
|
||||
|
||||
Your code is correct. Are you sure $now is set correctly?
try "SELECT COUNT(*) AS count FROM table WHERE when='". time()."' " |
#3
|
|||
|
|||
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. |
#4
|
|||
|
|||
jolten you should use rakes exmample, counting any other way is less efficient!
|
#5
|
|||
|
|||
I would but it doesn't seem to work.
|
#6
|
||||
|
||||
you need to mysql_fetch_array as you would any other query and then use $result['count']
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|