I use mysql_fetch_array whenever retrieving data from a database, but sometimes I know there is only one line of results returned from a query, and it seems like overkill to do a whole while() loop.
Here's a typical query:
$result = mysql_query("SELECT * FROM mytable WHERE id=23");
while ($myrow = mysql_fetch_array($result)) {
echo $myrow['title'];
}
Is there a way to ditch the "while()" bit? Seems like that forces it to step through a number of possible results when all I want is the first hit (or in this case, the only hit).