you can avoid using mysql_connect and mysql_close for every query
(they are the most costliest functions in your application)
you should not use mysql_result for this application
http://in2.php.net/function.mysql-result
try using mysql_fetch_assoc instead.
finally, use a good profiler, like
kranthi wrote:
you can avoid using mysql_connect and mysql_close for every query
(they are the most costliest functions in your application)
You're assuming that. It could be the queries being run are the costliest.
you should not use mysql_result for this application
You're assuming that. It could be the queries being run are the costliest.
It has got nothing to do with the cost of query. bare mysql_connect()
is very costly.
compare
?php
$time = microtime(true);
mysql_connect('localhost', 'user', 'pass');
//mysql_close();
echo (microtime(true) - $time) .
On Fri, Aug 7, 2009 at 5:10 PM, kranthikranthi...@gmail.com wrote:
You're assuming that. It could be the queries being run are the costliest.
It has got nothing to do with the cost of query. bare mysql_connect()
is very costly.
I'm not arguing with that, I'm saying that the cost of the
On Aug 6, 2009, at 7:52 PM, Ron Piggott ron@actsministries.org
wrote:
Is there a way to optimize this with better mySQL query?
# Select today's Bible verse
mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( Unable to select database);
$query=SELECT
Ron Piggott wrote:
Is there a way to optimize this with better mySQL query?
Step 1 - work out which bit is slow.
$start_time = time();
mysql_query ()
echo That took . (time() - $start_time) . secondsbr/\n;
I'd guess the first one is slow because of the order by random()
but that's