save current state
This commit is contained in:
parent
c2c1ee7b9b
commit
64d4eeb85d
9 changed files with 116 additions and 97 deletions
|
|
@ -18,12 +18,12 @@ if (LOGIN!="") {
|
|||
$edit_second_bill=money_to_bill($_POST['edit_second_bill']);
|
||||
$edit_third_id=$_POST['edit_third_id'];
|
||||
$edit_third_bill=money_to_bill($_POST['edit_third_bill']);
|
||||
mysql_query("UPDATE `games` SET `scoregame` = '$edit_scoregame', `location` = '$edit_location', `datetime` = '$edit_datetime', `player` = '$edit_player', `base_bill` = '$edit_base_bill', `first_id` = '$edit_first_id', `first_bill` = '$edit_first_bill', `second_id` = '$edit_second_id', `second_bill` = '$edit_second_bill', `third_id` = '$edit_third_id', `third_bill` = '$edit_third_bill' WHERE `games`.`id` =$EDIT_ID LIMIT 1 ; ",DB);
|
||||
mysqli_query($db, "UPDATE `games` SET `scoregame` = '$edit_scoregame', `location` = '$edit_location', `datetime` = '$edit_datetime', `player` = '$edit_player', `base_bill` = '$edit_base_bill', `first_id` = '$edit_first_id', `first_bill` = '$edit_first_bill', `second_id` = '$edit_second_id', `second_bill` = '$edit_second_bill', `third_id` = '$edit_third_id', `third_bill` = '$edit_third_bill' WHERE `games`.`id` =$EDIT_ID LIMIT 1 ; ");
|
||||
}
|
||||
|
||||
if (TO_DO=="new_game") {
|
||||
$query=mysql_query("SELECT `location` , `datetime` , `player` , `base_bill` , `first_id` , `first_bill` , `second_id` , `second_bill` , `third_id` , `third_bill` FROM `games` ORDER BY `games`.`id` DESC LIMIT 0 , 1",DB);
|
||||
$data=mysql_fetch_row($query);
|
||||
$query=mysqli_query($db, "SELECT `location` , `datetime` , `player` , `base_bill` , `first_id` , `first_bill` , `second_id` , `second_bill` , `third_id` , `third_bill` FROM `games` ORDER BY `games`.`id` DESC LIMIT 0 , 1");
|
||||
$data=mysqli_fetch_row($query);
|
||||
$hit=0;
|
||||
if ($data){
|
||||
foreach($data as $field) {
|
||||
|
|
@ -33,9 +33,10 @@ if (LOGIN!="") {
|
|||
}
|
||||
else $hit=1;
|
||||
if ($hit) {
|
||||
mysql_query("INSERT INTO `games` ( ) VALUES ( );",DB);
|
||||
$query=mysql_query("SELECT `id` FROM `games` ORDER BY `games`.`id` DESC LIMIT 0 , 1",DB);
|
||||
$data=mysql_fetch_row($query);
|
||||
mysqli_query($db, "INSERT INTO `games` ( `location`, `datetime`, `player`, `base_bill`, `first_id`, `first_bill`, `second_id`, `second_bill`, `third_id`, `third_bill` ) VALUES ( 'Bei Wem?', '1989-10-03 12:00:00', '', '200', '0', '0', '0', '0', '0', '0' );");
|
||||
echo "HERE" . mysqli_error($db);
|
||||
$query=mysqli_query($db, "SELECT `id` FROM `games` ORDER BY `games`.`id` DESC LIMIT 0 , 1");
|
||||
$data=mysqli_fetch_row($query);
|
||||
$EDIT_ID=$data[0];
|
||||
}
|
||||
else {
|
||||
|
|
@ -45,16 +46,16 @@ if (LOGIN!="") {
|
|||
}
|
||||
|
||||
if ($EDIT_ID) {
|
||||
$query=mysql_query("SELECT * FROM `games` WHERE `id` = $EDIT_ID LIMIT 0 , 1",DB);
|
||||
$data =mysql_fetch_array($query);
|
||||
$query=mysqli_query($db, "SELECT * FROM `games` WHERE `id` = $EDIT_ID LIMIT 0 , 1");
|
||||
$data =mysqli_fetch_array($query);
|
||||
$BODY.='<form action="index.php?page=edit_game&to_do=save_edit&edit_id='.$EDIT_ID.'" method="post">';
|
||||
$BODY.='<table class="list">';
|
||||
$BODY.='<tr><th>Location:</th><td colspan="3"><input type="text" name="edit_location" value="'.$data['location'].'"></td></tr>';
|
||||
$BODY.='<tr><th>Datum/Zeit:</th><td colspan="3"><input type="text" name="edit_datetime" value="'.$data['datetime'].'"></td></tr>';
|
||||
$BODY.='<tr><th>Spieler:</th><td colspan="3"><select size="10" name="edit_player[]" multiple>';
|
||||
$query=mysql_query("SELECT * FROM `player`",DB);
|
||||
$query=mysqli_query($db, "SELECT * FROM `player` ORDER BY alias");
|
||||
$player_of_game=player_of_game($EDIT_ID);
|
||||
while ($playerlist=mysql_fetch_array($query)) {
|
||||
while ($playerlist=mysqli_fetch_array($query)) {
|
||||
$selected="";
|
||||
foreach ($player_of_game as $player_in_game) $selected=($player_in_game==$playerlist['id']) ? " selected":$selected;
|
||||
$BODY.='<option value="'.$playerlist['id'].'," '.$selected.'>'.$playerlist['alias'].'</option>';
|
||||
|
|
@ -65,22 +66,22 @@ if (LOGIN!="") {
|
|||
$BODY.='<tr><th> </th><th>1. Platz</th><th>2. Platz</th><th>3. Platz</th></tr>';
|
||||
$BODY.='<tr><th>Spieler:</th>';
|
||||
$BODY.='<td><select size="1" name="edit_first_id">';
|
||||
$query=mysql_query("SELECT * FROM `player`",DB);
|
||||
while ($playerlist=mysql_fetch_array($query)) {
|
||||
$query=mysqli_query($db, "SELECT * FROM `player` ORDER BY alias");
|
||||
while ($playerlist=mysqli_fetch_array($query)) {
|
||||
$selected=($playerlist['id']==$data['first_id']) ? " selected":"";
|
||||
$BODY.='<option value="'.$playerlist['id'].'"'.$selected.'>'.$playerlist['alias'].'</option>';
|
||||
}
|
||||
$BODY.='</select></td>';
|
||||
$BODY.='<td><select size="1" name="edit_second_id">';
|
||||
$query=mysql_query("SELECT * FROM `player`",DB);
|
||||
while ($playerlist=mysql_fetch_array($query)) {
|
||||
$query=mysqli_query($db, "SELECT * FROM `player` ORDER BY alias");
|
||||
while ($playerlist=mysqli_fetch_array($query)) {
|
||||
$selected=($playerlist['id']==$data['second_id']) ? " selected":"";
|
||||
$BODY.='<option value="'.$playerlist['id'].'"'.$selected.'>'.$playerlist['alias'].'</option>';
|
||||
}
|
||||
$BODY.='</select></td>';
|
||||
$BODY.='<td><select size="1" name="edit_third_id">';
|
||||
$query=mysql_query("SELECT * FROM `player`",DB);
|
||||
while ($playerlist=mysql_fetch_array($query)) {
|
||||
$query=mysqli_query($db, "SELECT * FROM `player` ORDER BY alias");
|
||||
while ($playerlist=mysqli_fetch_array($query)) {
|
||||
$selected=($playerlist['id']==$data['third_id']) ? " selected":"";
|
||||
$BODY.='<option value="'.$playerlist['id'].'"'.$selected.'>'.$playerlist['alias'].'</option>';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue