freelance84 Posted May 14, 2010 Share Posted May 14, 2010 This may seem simple, but I have only been dealing with multiple returns from queries in the past. I now have a query where only one result is return, a string of text. The query in PHP looks like: $query_return_txt = "SELECT comment FROM matrix_general WHERE g_number = '$text[0]' AND a_number = '$text[1]' AND o_number = '$text[2]'"; The result of the query can only have one possible answer. What is the shortest way of getting the answer? Is it: $result = mysql_query($query_return_txt); $row = mysql_fetch_row($result); echo $row[0]; Quote Link to comment https://forums.phpfreaks.com/topic/201729-shortest-route-to-return/ Share on other sites More sharing options...
Zane Posted May 14, 2010 Share Posted May 14, 2010 mysql_result $result = mysql_query($query_return_txt); $thereturn = mysql_result($result, 0); Quote Link to comment https://forums.phpfreaks.com/topic/201729-shortest-route-to-return/#findComment-1058188 Share on other sites More sharing options...
ignace Posted May 14, 2010 Share Posted May 14, 2010 list($comment) = mysql_fetch_row($result); Quote Link to comment https://forums.phpfreaks.com/topic/201729-shortest-route-to-return/#findComment-1058190 Share on other sites More sharing options...
freelance84 Posted May 14, 2010 Author Share Posted May 14, 2010 ah brilliant. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/201729-shortest-route-to-return/#findComment-1058191 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.