Prodigal Son Posted August 1, 2008 Share Posted August 1, 2008 Quick question, when do I use mysql_result? Php.net says mysql_fetch_array and the alike are much much faster. How about if I am just grabbing one cell value? Currently I am using mysql_fetch_assoc on almost everything, even if its just one cell or row. Will mysql_result be better in that case? Or maybe another one of those differences you won't even notice? Edit: Oh yea, also I am using count(*) when counting rows, should I be using count(colname) instead? Is it faster? Link to comment https://forums.phpfreaks.com/topic/117710-solved-when-to-use-mysql_result/ Share on other sites More sharing options...
DarkWater Posted August 1, 2008 Share Posted August 1, 2008 Never use mysql_result. Ever. And use COUNT(*). It's fine because MySQL has to assemble the rows already do a single column count. Link to comment https://forums.phpfreaks.com/topic/117710-solved-when-to-use-mysql_result/#findComment-605460 Share on other sites More sharing options...
Prodigal Son Posted August 1, 2008 Author Share Posted August 1, 2008 Ah ok, looks like I don't have to change anything then. Link to comment https://forums.phpfreaks.com/topic/117710-solved-when-to-use-mysql_result/#findComment-605470 Share on other sites More sharing options...
.josh Posted August 1, 2008 Share Posted August 1, 2008 mysql_result is only really useful in a circumstance where you want to loop through results but inside the loop, you want to "look ahead" to a row/col further down the result list. I guess this is useful, but honestly I have yet to have need of it. Link to comment https://forums.phpfreaks.com/topic/117710-solved-when-to-use-mysql_result/#findComment-605473 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.