当前位置:Gxlcms > PHP教程 > 帮看下这段代码,插入数据库部分出有关问题,没找到异常

帮看下这段代码,插入数据库部分出有关问题,没找到异常

时间:2021-07-01 10:21:17 帮助过:18人阅读

帮看下这段代码,插入数据库部分出问题,没找到错误




War-game -Add Your score


War game - add your score


if(!empty($_POST['submit']))
{
$first_name=$_POST['first_name'];
$last_name=$_POST['last_name'];
$score=$_POST['score'];
echo $first_name;
echo $last_name;
echo $score;

$dbc=mysqli_connect('localhost','root','pengyu2408','score_list')or die('error in connet');
$query="INSERT INTO score_lis(first_name,last_name,score) VALUES('$first_name','$last_name','$score')";
mysqli_query($dbc,$query)or die('error_2');
echo '

Thanks for adding your new high score!

';
echo '

FIRST_NAME:'.$first_name.'
';
echo 'LAST_NAME:'.$last_name.'

';
echo '

Score:'.$score.'

';
echo '

<<Back to hight score

';
//clear the score data to clear the form
$firet_name="";
$last_name="";
mysqli_close($dbc);
}
?>

人气教程排行