php - insert into database session variable -
can please ? trying insert session variable part of dtabase row. other fields enter correctly 4 session variables declared @ top dont enter blank field in database. can tell me how insert session variable data please
<?php if(isset($_post['score'])) { require "dbconn.php"; $home = $_session['home']; $away = $_session['away']; $gameid = $_session['gameid']; $date = $_session['date']; $batsman = strip_tags($_post['batsman']); $bowler = strip_tags($_post['bowler']); $extras = strip_tags($_post['extras']); $wickets = strip_tags($_post['wickets']); $runs = strip_tags($_post['runs']); $over = strip_tags($_post['over']); $penalty=$runs+1; if ($extras == "none") {// sql insert statement add appropriate record / wide adds 1 + score onto bowler , total mysql_query (" insert statitstics2 (home, away, gameid, batsman, bowler, extras, wickets, runs, batscore, bowlscore, totalscore, over, date) values ('$home','$away','$gameid','$batsman','$bowler','$extras','$wickets','$runs', '$runs', '$runs', '$runs','$over','{$_session['date']}') ") or die("".mysql_error()); //here can write conformation or success message or use redirect header('location:./scorecard.php?pass=register success'); echo "ball added please add next ball"; } else if ($extras == "wide") { // sql insert statement add appropriate record / wide adds 1 + score onto bowler , total mysql_query ("insert statitstics2 (home, away, gameid, batsman, bowler, extras, wickets, runs, batscore, bowlscore, totalscore, over, date) values ('{$_session['home']}', '$away', '$gameid','$batsman','$bowler','$extras','$wickets','$runs', '0', '$penalty', '$penalty','$over','$date') ") or die("".mysql_error()); //here can write conformation or success message or use redirect header('location:./scorecard.php?pass=register success'); echo "ball added please add next ball"; } else if ($extras == "noball") { // sql insert statement add appropriate record / noball added runs onto batsman , runs plus penalty onto total , bowler mysql_query ("insert statitstics2 (home, away, gameid, batsman, bowler, extras, wickets, runs, batscore, bowlscore, totalscore, over, date) values ('{$_session['home']}', '$away', '$gameid','$batsman','$bowler','$extras','$wickets','$runs', '$runs', '$penalty', '$penalty','$over','$date') ") or die("".mysql_error()); //here can write conformation or success message or use redirect header('location:./scorecard.php?pass=register success'); echo "ball added please add next ball"; } else if ($extras=="legbyes") { // sql insert statement add appropriate record / leg byes added onto total mysql_query ("insert statitstics2 (home, away, gameid, batsman, bowler, extras, wickets, runs, batscore, bowlscore, totalscore, over, date) values ('{$_session['home']}','$away', '$gameid','$batsman','$bowler','$extras','$wickets','$runs', '0', '0', '$runs','$over','$date') ") or die("".mysql_error()); //here can write conformation or success message or use redirect header('location:./scorecard.php?pass=register success'); echo "ball added please add next ball"; } else if ($extras=="byes") { // sql insert statement add appropriate record / byes = score onto total mysql_query ("insert statitstics2 (home, away, gameid, batsman, bowler, extras, wickets, runs, batscore, bowlscore, totalscore, over, date) values ('{$_session['home']}', '$away','$gameid', '$batsman','$bowler','$extras','$wickets','$runs', '0', '0', '$runs','$over','$date') ") or die("".mysql_error()); //here can write conformation or success message or use redirect header('location:./scorecard.php?pass=register success'); echo "ball added please add next ball"; } } ?>
Comments
Post a Comment