After a particular query using PHP, I have a $result variable with only 1 row of data returned by the database.
I want to retrieve the data from this single row, but am not too keen on needing an entire while loop to do this seemingly simple request.
Is there a better way to get the data? I think mysqli_fetch_row() might do the trick, but it seems to only allow access via integer indexes.
Any better solutions??
If you are sure that there will always be only one row, then no, you MUST not use a loop.
Also, you can use
mysqli_fetch_assoc()instead ofmysqli_fetch_row().