I am trying to read table data and display in on a table the only thing is that i am trying to read it on 2 tables. The 2 tables have the same structure and i have tried it with the code below but nothing happens.
$sql = "SELECT pricedatamt5.symbol_name, pricedatamt5.symbol_bid, pricedatamt5.symbol_ask, pricedatamt4.symbol_bid, pricedatamt4.symbol_ask FROM pricedatamt5 LEFT JOIN pricedatamt4 ON pricedatamt5.symbol_name = pricedatamt4.symbol_name WHERE symbol_name='".$value."'";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result))
{
echo "<tr>";
echo "<td>".$row["symbol_date"]."</td>";
echo "<td>".$row["symbol_bid"]."</td>";
echo "<td>".$row["symbol_ask"]."</td>";
echo "</tr>";
}
I hope you can help me with this one because i am really having a hard time especially on retrieving data from 2 tables.
Thanks...
if you need the union your sql query will be:
$sql = "SELECT pricedatamt5.symbol_name, pricedatamt5.symbol_bid, pricedatamt5.symbol_ask FROM pricedatamt5 WHERE symbol_name='".$value."'"."
UNION
SELECT pricedatamt4.symbol_name, pricedatamt4.symbol_bid, pricedatamt4.symbol_ask FROM pricedatamt4 WHERE symbol_name='".$value."'";
otherwise you should clarify your question.