Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
需要更新记分牌PHP SQL吗_Php_Sql_If Statement - Fatal编程技术网

需要更新记分牌PHP SQL吗

需要更新记分牌PHP SQL吗,php,sql,if-statement,Php,Sql,If Statement,我需要为学校做一个项目,在那里我必须能够输入两个相互竞争的团队(拳击手),获胜的团队(拳击手)将在记分板上排名上升 不知何故,我只能设法输入决定球员排名的胜利数,但他们需要互相争斗,结果应该更新记分板 这有点重要,最后期限很快就要到了,所以我们非常感谢您的帮助 <html> <head> <title>Welterweight Pound for Pound Reigning Champions</title> </head> <

我需要为学校做一个项目,在那里我必须能够输入两个相互竞争的团队(拳击手),获胜的团队(拳击手)将在记分板上排名上升

不知何故,我只能设法输入决定球员排名的胜利数,但他们需要互相争斗,结果应该更新记分板

这有点重要,最后期限很快就要到了,所以我们非常感谢您的帮助

<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);
}
?>

次中量级冠军一磅换一磅
次中量级冠军一磅换一磅
战斗机名称:
获胜次数:

你的具体问题是什么?此外,停止使用
mysql\uuz
函数,最好改用
mysqli\uz
PDO
函数。我需要能够通过表单输入fighter 1 vs fighter 2=结果,结果应该在它下面的记分板中更新
mysql\uz
函数已经被弃用很长时间了,并在PHP7中完全删除。您应该迁移到
PDO
mysqli
a.s.a.p.否则您将容易受到安全问题的攻击(由于缺少参数化查询或任何输入检查,您的代码已经非常容易受到SQL注入攻击),并且在更改之前无法升级到较新的PHP版本。有关SQL注入的介绍以及如何保护数据的一些示例,请参阅。这可能只是一个学校项目,但你现在应该养成良好的习惯。“我需要能够通过表格输入fighter 1 vs fighter 2=结果,结果应该在下面的记分板中更新。”。这是你的要求。但这不是一个问题。那么…你的代码怎么了?它现在做什么?理想情况下,给出一个使用特定数据和/或错误消息(视情况而定)来演示问题的示例。如果你还没有写过这个功能,恐怕这不是适合你的论坛。我们修复bug,我们不创建全新的代码。