Skip to content

Instantly share code, notes, and snippets.

@jamsesso
Created June 16, 2010 20:14
Show Gist options
  • Save jamsesso/441198 to your computer and use it in GitHub Desktop.
Save jamsesso/441198 to your computer and use it in GitHub Desktop.
<?php
//Get the library.
require "mysql.php";
//New connection.
$db = new MySQL("localhost", "username", "password", "database");
if($db->errno())
{
print($db->error());
exit;
}
$select = $db->prepare("SELECT * FROM table WHERE something = :something AND place = :place LIMIT 1");
$select.= $db->bind(array(":something", ":place"), array("cars", "canada"));
$select.= $db->execute();
$row = $db->fetch($select, OBJECT);
echo "Hi there, ".$row->something;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment