GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   php or mysql? (https://gfy.com/showthread.php?t=417704)

kemp 01-16-2005 10:39 PM

php or mysql?
 
I have a mysql table filled with crap. I need to pull random lines from this table making sure that each time I query a line that is can not be queried again.

Which is better, doing it all as a mysql statement, or doing it inside of php? Either way I will have to figure out the method to do it, but maybe one of you php pros can point me in the right direction so I learn the right one first...:)

Crypt 01-16-2005 10:43 PM

Put a special flag in a field when you use it the first time

Varius 01-16-2005 11:01 PM

Done right, you should always opt for doing it in mysql when you can as oppoed to in php.

For example, you might be pulling all your rows into an array and then picking out a random one in php....It's much more effective to use Mysql's function RAND instead in your actual query.

woj 01-16-2005 11:03 PM

Quote:

Originally Posted by Varius
Done right, you should always opt for doing it in mysql when you can as oppoed to in php.

For example, you might be pulling all your rows into an array and then picking out a random one in php....It's much more effective to use Mysql's function RAND instead in your actual query.

True, in most cases, using mysql query is better than picking random in php code.

kemp 01-16-2005 11:49 PM

Thanks guys. My knowledge on the subject is a little thin so your advice will certainly help make my new tgp more productive!


All times are GMT -7. The time now is 05:31 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123