Besides it was also towards encouraging to write compact code. There are two ways queries can be created – firstly through the query() method and secondly through the prepare() method.. PHP SQLite3 tutorial shows how to create database programs in PHP and SQLite database. You must always use prepared statements for any SQL query that would contain a PHP variable. Edit: If you are just starting out though, you might want to follow a tutorial like this one which should take you through a nice step by step (and more importantly up to date functions) that will get you started. Example. This first code example returns all rows (no WHERE clause is specified) and all columns (using the *) from the Product table in the AdventureWorks2012 database. Instead, the form data or request for the web page gets sent to a web server to be processed by the PHP scripts. Once you have created a PDO you can begin querying the database. Well organized and easy to understand Web bulding tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, and XML. For example, you can select all records; you can choose few records based on the condition specified in WHERE clause, select all columns using the wild card (*) or only selecting a few columns by explicitly declaring them in a query. Also, here's a great resource to learn PDO prepared statements, which is the better choice for beginners and most people in general. In this tutorial you'll learn how to select records from a MySQL table using PHP. To select rows that satisfy a specified condition, you use a WHERE clause.. PostgreSQL WHERE clause overview.