Chi Shen Chi Shen - 1 year ago 54
MySQL Question

how to display data in one page from different database table

i have database that having 2 table which is event , venue.

the event table hold eventTitle , eventID and venueID.

the venue table hold venueID , venueName and location.

this is my sql query .

$sqlEvent = "SELECT * FROM te_events , te_venue ORDER by eventTitle
WHERE te_events.venueID = te_venue.venueID

but there is an error
u have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE te_events.venueID = te_venue.venueID' at line 2

what i want to do is display the venuename and location in the page by using php script.
after i remove 'where' clause, everything works find but the event is repeated.

Answer Source

Wrong clause where sequence

"SELECT * FROM te_events , te_venue 
  WHERE te_events.venueID = te_venue.venueID
ORDER by eventTitle  ";

In a select the where clasue is before the order by

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download