$db = new mysqli('localhost', 'username', 'password', 'world');Create & execute a query statement
$statement = $db->prepare('select Code,Name from Country where Population > 100000000'); $statement->execute(); $statement->bind_result($code, $name); while ($statement->fetch()) echo "$code $name <br>\n"; $statement->close();Adding new entries to a table
$statement = $db->prepare('insert into Country (Code, Name, Continent, Region, LocalName, GovernmentForm) values ("FRE", "Freedonia", "Europe", "Unknown", "Freedonia", "Anarchy")'); $statement->execute(); $statement->close();Changing existing data
$statement = $db->prepare('update City set Population=10 where Name="Buffalo"'); $statement->execute(); $statement->close();
World database: http://gamera.caset.buffalo.edu/world.sql
PHPMyAdmin: http://gamera.caset.buffalo.edu/phpMyAdmin