PHP code example of canteen / database

1. Go to this page and download the library: Download canteen/database library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

canteen / database example snippets




use Canteen\Database;
$db = new Database(
	'localhost', 	// MySQL host
	'root', 		// MySQL username
	'12341234', 	// MySQL user's password
	'my_database'	// Database name
);

// Create a select query of a properties
// on a user's table of all active users
$users = $db->select('user_id', 'first_name', 'last_name')
	->from('users')
	->where('active=1')
	->results();