search

Home  >  Q&A  >  body text

How can PHP display SQL query results through an array? There are multiple query results, as shown in the figure.

How does PHP display SQL query results through an array? There are multiple query results, as shown in the figure. I want the $date in the echo in forsearch to be an array. Instead of using $date directly, output $date[start], $date[start], $date[goal], $date[airline], $date[flight-no] separately. ,$date[voyage],

$date[transit_airport],$date[_45kg],$date[_100kg],, $date[_300kg],$date[_500kg],`$date[_1000kg] ,`$date[remarks],$date[exp]. Because I want to receive each input value using PHP instead of using a table to display the output, I want to submit the query results to other pages. Is there any way to achieve this? Now my output shows tart`, `goal`, `airline`, `flight_no`, `voyage`, `transit_airport`, `_45kg`, `_100kg`, `_300kg`, `_500kg`, `_1000kg`, ` remarks`, `exp`, are not defined.

杭州云庄国际********杭州云庄国际********1539 days ago1030

reply all(1)I'll reply

  • 杭州云庄国际********

    杭州云庄国际********2020-10-19 23:05:03

    $sql = "SELECT `start`, `goal`, `airline`, `flight_no`, `voyage`, `transit_airport`, `_45kg`, `_100kg`, `_300kg`, `_500kg`, `_1000kg`, ` remarks`, `exp`, `remaining_position` FROM airprice WHERE start='{$airfull["start"]}' and goal='{$airfull["goal"]}'";$result = mysqli_query($link, $sql);if (!$result) { printf("Error: %s\n", mysqli_error($link)); exit();}echo '';echo '';echo 'Departure airport destination airport airline Flight number Flight number Transit airport 45kg 100kg 300kg 500kg 1000kg Freight note Validity period Remaining position ';echo '';while ($row = mysqli_fetch_row($result)){ echo ''; foreach ($row as $data) { echo "{ $data}"; } echo ""; echo '';}echo ''; This is the current code

    reply
    1
  • Cancelreply