将sql查询的int结果返回给php echo?

A little help would be lifesaving. I have an sql query that works in phpMyAdmin and gives me the result i need. When i build this query into a php statement i cant seem to access the result (an integer) I literally need to echo the value, so i need to output for exanmple " your number is" result.

here is my query:

$sqlstatement = "SELECT (SELECT `embark` FROM info ORDER BY `index_no` DESC LIMIT 1)-(SELECT `embark` FROM info ORDER BY `index_no` ASC LIMIT 1)";
$sql_result = mysqli_query($connection, $sqlstatement) or die (" Couldn't execute the SQL calculate disembark statement********");

If anyone can help i would really appreciate it Scott

Fetch the row of results into an array, and then access the element of the array to echo it.

$row = mysqli_fetch_array($sql_result);
if ($row) {
    echo "Your number is " . $row[0];
}

I used mysqli_fetch_array because you didn't assign an alias to the result column.

BTW, you can simplify your query to:

SELECT MAX(index_no)-MIN(index_no) FROM info