需要更新记分板PHP SQL

时间:2016-03-22 11:20:08

标签: php sql if-statement

我需要为学校制作一个项目,我必须能够输入两个相互竞争的队伍(拳击手),并且获胜的队伍(拳击手)将在记分牌上排名上升。

不知怎的,我只能设定决定玩家等级的胜利次数,但他们需要互相争斗,结果应该更新记分牌。

它的重要性和截止日期即将结束,所以任何帮助都会受到赞赏。

<html>
<head>
<title>Welterweight Pound for Pound Reigning Champions</title>
</head>
<body>
<h1>Welterweight Pound for Pound Reigning Champions</h1>
<form action="display.php" method= "post">
Name of fighter: <input type="text" name="name"><br />

Number of wins: <input type="text" name="wins"><br />

<input type="submit" name="verzenden" >
</form>
<?php
if (isset($_POST['verzenden'])){

$con = mysql_connect("localhost","root","usbw");
if (!$con){
die("Can not connect: " . mysql_error());
}

mysql_select_db("boksen", $con);
$sql = "INSERT INTO fighters (name, wins) VALUES            ('$_POST[name]','$_POST[wins]')";
header("Location: http://localhost:8080/display.php");
mysql_query($sql,$con);
mysql_close($con);
}
?>

0 个答案:

没有答案