Skip to content

Instantly share code, notes, and snippets.

@ryanseys
Last active August 29, 2015 14:11
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 ryanseys/99a7b81a25fa5cfeceb9 to your computer and use it in GitHub Desktop.
Save ryanseys/99a7b81a25fa5cfeceb9 to your computer and use it in GitHub Desktop.
database.php
<?php
$db = new mysqli("localhost", "root", "password", "courses");
$sql = "INSERT INTO prerequisites VALUES('elec2501', 'phys1004', 'math1005', '')";
$db->query($sql);
echo "done";
$sql2 = "SELECT * FROM prerequisites";
$rows = $db->query($sql2);
while($row = $rows->fetch_object()) {
echo "<li>".$row->title."</li>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment