Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 16, 2016
0 parents commit f5362a0
Show file tree
Hide file tree
Showing 520 changed files with 122,324 additions and 0 deletions.
Binary file added 9781430239789.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Ch02_complexity_simplicity/0.ogg
Binary file not shown.
Binary file added Ch02_complexity_simplicity/0.wav
Binary file not shown.
Binary file added Ch02_complexity_simplicity/1.ogg
Binary file not shown.
Binary file added Ch02_complexity_simplicity/1.wav
Binary file not shown.
Binary file added Ch02_complexity_simplicity/2.ogg
Binary file not shown.
Binary file added Ch02_complexity_simplicity/2.wav
Binary file not shown.
Binary file added Ch02_complexity_simplicity/3.ogg
Binary file not shown.
Binary file added Ch02_complexity_simplicity/3.wav
Binary file not shown.
Binary file added Ch02_complexity_simplicity/4.ogg
Binary file not shown.
Binary file added Ch02_complexity_simplicity/4.wav
Binary file not shown.
Binary file added Ch02_complexity_simplicity/5.ogg
Binary file not shown.
Binary file added Ch02_complexity_simplicity/5.wav
Binary file not shown.
Binary file added Ch02_complexity_simplicity/ball.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions Ch02_complexity_simplicity/beginScore.php
@@ -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)


?>
Binary file added Ch02_complexity_simplicity/flip.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Ch02_complexity_simplicity/help.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions Ch02_complexity_simplicity/highscorelist.php
@@ -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)


?>


0 comments on commit f5362a0

Please sign in to comment.