Skip to content

Instantly share code, notes, and snippets.

@temitope
Created June 7, 2014 19:42
Show Gist options
  • Save temitope/1d5b566adb9de4334325 to your computer and use it in GitHub Desktop.
Save temitope/1d5b566adb9de4334325 to your computer and use it in GitHub Desktop.
test mysqli libraries
<?php
//grab the vars needed out of the form post body
//connect to mysql database (so we can run commands)
// Create connection
$con=mysqli_connect("127.0.0.1","root","","test");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM goals");
while($row = mysqli_fetch_array($result)) {
echo $row['name'] . "-" . $row['id'];
echo "<br>";
}
//insert a new goal into the mysql database
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment