mysql - PHP Not uploading submitted data to the db -


i'm sure i've made simple mistake, yet having troubles finding it. basically, whenever fills in normal form, data enter submitted db table, later posted on page of site. however, not seem working.

if possible, i'd in right direction i've done wrong.

thanks in advance, hope post isn't annoying. i'm new here :,)

php:

<?php      session_start();     include_once("connection.php");      if(isset($_post['post'])) {         $match_name = strip_tags($_post['match_name']);             $team1 = strip_tags($_post['team1']);                 $player1 = strip_tags($_post['player1']);                 $player2 = strip_tags($_post['player2']);                 $player3 = strip_tags($_post['player3']);                 $player4 = strip_tags($_post['player4']);                 $player5 = strip_tags($_post['player5']);              $team2 = strip_tags($_post['team2']);                 $player6 = strip_tags($_post['player6']);                 $player7 = strip_tags($_post['player7']);                 $player8 = strip_tags($_post['player8']);                 $player9 = strip_tags($_post['player9']);                 $player10 = strip_tags($_post['player10']);          $match_name = mysqli_real_escape_string($dbcon, $match_name);             $team1 = mysqli_real_escape_string($dbcon, $team1);                 $player1 = mysqli_real_escape_string($dbcon, $player1);                 $player2 = mysqli_real_escape_string($dbcon, $player2);                 $player3 = mysqli_real_escape_string($dbcon, $player3);                 $player4 = mysqli_real_escape_string($dbcon, $player4);                 $player5 = mysqli_real_escape_string($dbcon, $player5);             $team2 = mysqli_real_escape_string($dbcon, $team2);                 $player6 = mysqli_real_escape_string($dbcon, $player6);                 $player7 = mysqli_real_escape_string($dbcon, $player7);                 $player8 = mysqli_real_escape_string($dbcon, $player8);                 $player9 = mysqli_real_escape_string($dbcon, $player9);                 $player10 = mysqli_real_escape_string($dbcon, $player10);          $sql = "insert `match` (match_name, team1, player1, player2, player3, player4, player5, team2, player6, player7, player8, player9, player10) values ('$team1, '$player1', '$player2', '$player3', '$player4', '$player5', '$team2, '$player6', '$player7', '$player8', '$player9', '$player10')";                        if($match_name == "") {             echo "you're missing title varible <strong>match title</strong> | <a href='post.php'>go back</a>";             return;         }          if($team1 == "") {             echo "you're missing title varible <strong>team 1 name</strong> | <a href='post.php'>go back</a>";             return;         }          if($team2 == "") {             echo "you're missing title varible <strong>team 2 name</strong>";             return;         }          mysqli_query($dbcon, $sql);          header("location: index.php");     } ?> 

moving forward @arkascha , @jay blanchard mentioned.

you missing single quotes ' in sql query near values of '$team1 , '$team2 :

instead of this:

$sql = "insert `match` (match_name, team1, player1, player2, player3, player4, player5,  team2, player6, player7, player8, player9, player10)  values ('$team1, '$player1', '$player2', '$player3', '$player4', '$player5',  '$team2, '$player6', '$player7', '$player8', '$player9', '$player10')";               

try this:

$sql = "insert `match` (match_name, team1, player1, player2, player3, player4, player5,  team2, player6, player7, player8, player9, player10)  values ('$team1', '$player1', '$player2', '$player3', '$player4', '$player5',  '$team2', '$player6', '$player7', '$player8', '$player9', '$player10')"; 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -