How to read the last record from the table, set it to a variable?

Good day to all. There is a request:

SELECT id_b FROM flop WHERE id_a='$id' ORDER BY flop.id_b DESC LIMIT 0, 1

In short, I pull out the last record from the table (but not from the whole table, but by the condition id_a='$id').

How to determine what id_bis?


Answer 1, authority 100%

$res = mysql_query('SELECT `id_b` FROM `flop` WHERE `id_a`='.$id.' ORDER BY `flop`.`id_b` DESC LIMIT 0, 1');
$row = mysql_fetch_assoc($res);
echo $row['id_b'];

Read the documentationfor mysql functions.