I have the following query that I'm using to fetch a user's last IP address from the table "user" and I'm trying to compare it against a session IP. Is the following okay code or should this be condensed a bit more?
PHP Code:
$query "SELECT u_last_ip 
              FROM user 
              WHERE u_last_ip = 
$match mysql_query($query) or die(mysql_error());

$row mysql_fetch_array($match)){
$last_known_ip $row[0];

I guess the main reason I'm concerned here is because I've used an entire while control structure to extract only 1 value from that resource.

What are the more efficient alternatives for minor retrievals like this?