Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Apress
committed
Oct 16, 2016
0 parents
commit f5362a0
Showing
520 changed files
with
122,324 additions
and
0 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
$dbhost = 'localhost'; | ||
$dbuser = 'user'; | ||
$dbpass = 'pass'; | ||
$dbname = 'name'; | ||
$dbtable = 'test'; | ||
|
||
|
||
$con = mysql_connect($dbhost,$dbuser,$dbpass); | ||
if (!$con) | ||
{ | ||
die('Could not connect: ' . mysql_error()); | ||
} | ||
|
||
mysql_select_db($dbname, $con); | ||
|
||
|
||
$query = "SELECT * FROM `$dbtable` ORDER BY score DESC, name ASC"; | ||
|
||
$result = mysql_query($query); | ||
|
||
while($row = mysql_fetch_array($result)){ | ||
echo $row['score'].",".$row['name'].":"; | ||
} | ||
|
||
mysql_close($con) | ||
|
||
|
||
?> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
$dbhost = 'localhost'; | ||
$dbuser = 'user'; | ||
$dbpass = 'pass'; | ||
$dbname = 'name'; | ||
$dbtable = 'test'; | ||
|
||
|
||
$con = mysql_connect($dbhost,$dbuser,$dbpass); | ||
if (!$con) | ||
{ | ||
die('Could not connect: ' . mysql_error()); | ||
} | ||
|
||
mysql_select_db($dbname, $con); | ||
|
||
|
||
$tempNum=$_POST[score]; | ||
$tempName =$_POST[name]; | ||
|
||
$sql = "INSERT INTO $dbtable (score, name) | ||
VALUES ('$tempNum', '$tempName')"; | ||
|
||
|
||
if (!mysql_query($sql,$con)) | ||
{ | ||
die('Error: ' . mysql_error()); | ||
} | ||
|
||
$query = "SELECT * FROM `$dbtable` ORDER BY score DESC, name ASC"; | ||
|
||
$result = mysql_query($query); | ||
|
||
|
||
while($row = mysql_fetch_array($result)){ | ||
echo $row['score'].",".$row['name'].":"; | ||
} | ||
|
||
mysql_close($con) | ||
|
||
|
||
?> | ||
|
||
|
Oops, something went wrong.