S
S
sunnyrio2018-04-14 21:27:14
MySQL
sunnyrio, 2018-04-14 21:27:14

How to make that when selecting from 2 tables, only the data of the first one and not both are entered into the array?

How to make that when selecting from 2 tables, only the data of the first one and not both are entered into the array?
An array of 2 tables is displayed on the screen, and I need to have only lines from the ShippingOffer in the array after the selection.
The code:

$sql = mysql_query("SELECT * FROM `ShippingOffer` LEFT JOIN `ShippingRequest` USING (station_id) WHERE ShippingOffer.station_id_end = ShippingRequest.station_id_end");
  $i = 0;
  while ($row  = mysql_fetch_row($sql))
  {
    $arr_so[$i] = $row;
    echo "<p>".var_dump($arr_so[$i])."</p>";
    $i++;
  }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2018-04-14
@sunnyrio

Instead of an asterisk, list the required fields.

S
sunnyrio, 2018-04-14
@sunnyrio

ShippingOffer.id, ShippingOffer.station_id, etc. Thus?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question