Can I write a query in MYSQL (eventually for PHP + MySQL) such that I can check across multiple tables in a sort of array?
For example
Suppose I have tables client, car, rate
Each table has an ID.
In client are rows … ID, Name, address
In car are rows … ID, Make, Model, Year, License plate number
In rate are rows … ID, 1-day, 2-day, 3-day
would the following work?:
SELECT name, make, model, license plate number, 1-day FROM client, car, rate WHERE make = ford
or in PHP
$q = "SELECT name, make, model, license plate number, 1-day FROM client, car, rate WHERE make = ford";
would this be correct syntax?
No, you can´t. Not the way you are presenting it here. What you can do is JOINS if the tables are related to each other. Otherwise you´d probably have to select from one table at the time.
You may also implement an iterative solution in PHP to return from several tables or consider doing it on the database side with a stored procedure.
Normally when using a relational database there are relations between the tables so that you may perform join operations on them as such (a very loose example since I do not know anything about the context in which you are working):
Related: link