Skip to content

Instantly share code, notes, and snippets.

@ixti
Created May 25, 2010 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ixti/413635 to your computer and use it in GitHub Desktop.
Save ixti/413635 to your computer and use it in GitHub Desktop.
CREATE TABLE IF NOT EXISTS `my_table` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ;
INSERT INTO `automobili_news` (`id`, `title`) VALUES
(1, '3858f62230ac3c915f300c664312c63f'),
(2, 'da1c45547c18497b29ef722481693066'),
(3, '4874f7aef9eeea0098e7a7ca7d01e374'),
(4, '9ec771cfd7570c5629fc96b4427679f2'),
(5, 'dc4d1528173d01cf17953cb6d3066bca'),
(6, '176419159afa5836d1fdf667653bdb04'),
(7, '5df0ca2ddb039a5504cf386c2f3b1480'),
(8, '88a649fd4de856bfc97e5c1ee8c5c05a');
<?php
$host = 'localhost';
$user = 'user';
$pass = 'pass';
$name = 'test';
header('Content-Type: text/plain');
$mysqli = mysqli_connect($host, $user, $pass, $name);
if ($result = $mysqli->query('SELECT * FROM `my_table`')) {
while ($obj = $result->fetch_object()) {
echo $obj->id . ' - ' . $obj->title . PHP_EOL;
}
mysqli_free_result($result);
$result->close();
}
$mysqli->close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment