Skip to content

Instantly share code, notes, and snippets.

@montes
Last active December 17, 2015 01:49
Show Gist options
  • Save montes/5531508 to your computer and use it in GitHub Desktop.
Save montes/5531508 to your computer and use it in GitHub Desktop.
Quick mysql+php script
<?php
$mysqli = new mysqli("localhost", "root", "password", "database");
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
/*
$sql = "";
$mysqli->query($sql);
*/
$sql = "SELECT * FROM users";
$result = $mysqli->query($sql);
if ($result) {
while ($row = $result->fetch_object()) {
echo $user->email . '<br>';
}
$result->close();
$mysqli->next_result();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment