Last active
December 13, 2015 23:09
-
-
Save lennondtps/4989300 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
$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