简体   繁体   中英

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 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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM