Skip to content

Instantly share code, notes, and snippets.

@lennondtps
Last active December 13, 2015 23:09
Show Gist options
  • Save lennondtps/4989300 to your computer and use it in GitHub Desktop.
Save lennondtps/4989300 to your computer and use it in GitHub Desktop.
<?php
$username = "root";
$password = "";
$hostname = "localhost";
//Syndesi me vasi
$con = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
//Epilogi Database
$selected = mysql_select_db("grades_db",$con)
or die("Could not select examples");
//Ektelesi twn queries
$result = mysql_query("SELECT Name,Surname,Grade FROM grades ORDER BY Grade");
//fetch data kai xrisi tis while (an den valete while 8a sas vgalei mono to prwto apotelesma)
while ($row = mysql_fetch_array($result)) {
printf("%s %s %s</br>", $row["Name"], $row["Surname"], $row["Grade"]);
}
//kleisimo sindesis
mysql_close($con);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment