|
Not logged in [Login - Register] |
You Are Not Registered Or Not Logged In |
Corsa Sport » Message Board » Off Day » Geek Day » Php help? (mysql_num_rows) » Post Reply
|
Dom |
posted on 15th Jan 10 at 14:38 |
php.net, for explainations and examples ;) :thumbs: | |
Sam |
posted on 15th Jan 10 at 13:48 |
:) | |
ed |
posted on 15th Jan 10 at 13:17 |
Alright alright, he seems a clever lad I'm sure he'll see the suggestions and be able to do a bit of reading around. | |
Sam |
posted on 15th Jan 10 at 12:37 |
Yes I know it's not hard, but he needs to learn what the functions do first. It's all very well telling him to do this that and the other but if he doesn't understand what the hell things do he won't understand how/why he needs to do them different as he progresses! | |
ed |
posted on 15th Jan 10 at 12:27 |
Learning how to write things into modular functions the first time round isn't exactly hard though. It promotes you to properly plan a structure also which saves a lot of time. | |
Sam |
posted on 15th Jan 10 at 12:18 |
I think Whittie needs to first understand how he has to do things, before learning how to do them differently? | |
Whittie |
posted on 15th Jan 10 at 12:10 |
Got a lot to learn :( | |
ed |
posted on 15th Jan 10 at 12:05 |
I also tend to write a function for mysql queries. So that: | |
ed |
posted on 15th Jan 10 at 12:04 |
Also, store your MySQL connection in a file and include it in every page you require a connection. Modularity again... | |
ed |
posted on 15th Jan 10 at 12:02 |
For what you want you should either write it so that it echos the data as JSON, or you should write it as a function which returns the value. It makes your script more modular and you can re-use it else where in the site. If you have it return it as JSON then you would then need some Javascript to get it onto the page, but then with a bit of AJAX you could have it update live. No real need to do it what way, but it's just the difference between a website an a web app :) | |
Sam |
posted on 15th Jan 10 at 10:42 |
:D :wave: | |
Whittie |
posted on 15th Jan 10 at 10:26 |
Perfect! Thanks Sam :wave: | |
Sam |
posted on 15th Jan 10 at 10:22 |
http://www.tizag.com/mysqlTutorial/mysqlcount.php | |
Whittie |
posted on 15th Jan 10 at 10:05 |
Been looking online and in my book. They both say this should work, but it doesn't :o (Obviously, yes i did replace the user / password / db name). code: | |
Whittie |
posted on 15th Jan 10 at 09:41 |
Thank you :) | |
Laney |
posted on 15th Jan 10 at 09:30 |
quote: Or possibly a SELECT COUNT(*) on the table :) | |
ed |
posted on 15th Jan 10 at 07:46 |
In PHP MySQL you'd use MYSQL_NUM_ROWS to retrieve the number of records in a table. | |
Whittie |
posted on 15th Jan 10 at 01:25 |
http://is.gd/ |