jefSofeZemy
New Member
I'm porting some old PHP code from mysql to MySQLi, and I've ran into a minor snag. Is there no equivalent to the old \[code\]mysql_result()\[/code\] function? Because I can't find one anywhere in the documentation, here on Stack Overflow, or anywhere else with Google...I know \[code\]mysql_result()\[/code\] is slower than the other functions when you're working with more than 1 row, but a lot of the time I have only 1 result and 1 field. Using it lets me condense 4 lines into 1, and I'm lazy.Old code:\[code\]if ($r && mysql_num_rows($r)) $blarg = mysql_result($r, 0, 'blah');\[/code\]Desired code:\[code\]if ($r && $r->num_rows) $blarg = $r->result(0, 'blah');\[/code\]But there is no such thing. Is there something I'm missing? Or am I going to have to suck it up and make everything:\[code\]if ($r && $r->num_rows) { $row = $r->fetch_assoc(); $blarg = $row['blah']; }\[/code\]Thanks for any help you can provide.