Skip to content

Instantly share code, notes, and snippets.

@blissdev
Created November 20, 2008 09:19
Show Gist options
  • Save blissdev/26993 to your computer and use it in GitHub Desktop.
Save blissdev/26993 to your computer and use it in GitHub Desktop.
<?php
require_once 'MDB2.php';
$dsn = 'mysql://victoryfund:pixeltal@localhost/victoryfund'
//$dsn = 'mysql://[email protected]/vfmaps';
$sql = "CREATE TABLE `geocoded_entries` (
`id` int(50) NOT NULL auto_increment,
`first_name` varchar(50) default NULL,
`last_name` varchar(50) default NULL,
`lat` varchar(50) default NULL,
`lng` varchar(50) default NULL,
`message` varchar(255) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7185 DEFAULT CHARSET=latin1";
echo $sql;
$mdb2 =& MDB2::connect($dsn);
if (PEAR::isError($mdb2)) {
die($mdb2->getMessage());
}
// Proceed with a query...
$res =& $mdb2->query($sql);
// Always check that result is not an error
if (PEAR::isError($res)) {
echo($res->getMessage());
}
// Disconnect
$mdb2->disconnect();
echo "Table created successfully.";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment