Previous Lecture Complete and continue  

  Select all records from a database

How to return all the records from a database using SQL embedded in PHP.

If you get the error "Call to a member function on a non-object", then there is a mismtach between the database column names you have supplied in the PHP and those you have actually used in the table. Double check that you have not, for instance named a column `first_name` when it should be `firstname`.

Backticks (` `), for which the key on a UK/US keyboard is at the top left next to the key for '1', can be used to enclose column names if there is a danger that you have used MySQL reserved words to name database columns. To do so is not good practice and should be avoided. As long as your database column names have no special meaning in MySQL, you do not need to enclose them in backticks.