Last active
December 17, 2015 01:49
-
-
Save montes/5531508 to your computer and use it in GitHub Desktop.
Quick mysql+php script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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