Php 表格won';不发送到MySQL数据库?
删除Php 表格won';不发送到MySQL数据库?,php,mysql,Php,Mysql,删除“$desc”中的最后一个逗号, <?php require_once('../../config/auth.php'); include "../../config/connection.php"; $rank = $_SESSION['SESS_USER_RANK']; if ($rank == 0){ header("location: ../../errors/606.php"); exit(); } $custom = $_POST['name']; $ulx =
“$desc”中的最后一个逗号,
<?php require_once('../../config/auth.php');
include "../../config/connection.php";
$rank = $_SESSION['SESS_USER_RANK'];
if ($rank == 0){
header("location: ../../errors/606.php");
exit();
}
$custom = $_POST['name'];
$ulx = $_POST['ulx'];
$price = $_POST['price'];
$desc = $_POST['desc'];
$addrank = "INSERT INTO ranks (rank_name, rank_ulx_name, rank_price, pr_desc)
VALUES ('$custom', '$ulx', '$price', '$desc',)";
mysql_query($addrank);
header("location: ../../editranks.php");
exit();
?>
<h4>Add Custom Rank</h4>
<table class="table table-hover table-hover">
<thead>
<tr>
<th>Rank Name</th>
<th>Ulx Name</th>
<th>Price</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<form method="post" action="functions/admin/addrank.php"><tr>
<td style="width: 14%;"><input class="form-control" type="text" name="name" value=""></td>
<td style="width: 14%;"><input class="form-control" type="text" name="ulx" value=""></td>
<td style="width: 14%;"><input class="form-control" type="text" name="price" value=""></td>
<td style="width: 15%;"><input class="form-control" type="text" name="desc" value=""></td>
<td style="width: 11%;"><input class="btn btn-primary" type="submit" value="Add Rank!"></a></td>
</tr></form>
</tbody>
</table>
另外,请注意SQL注入
使用函数:(我建议您使用并与,或一起使用)
$con
一旦您(希望)转向使用,它就是一个DB连接变量
举个例子
mysql.*
函数已弃用,将从未来的PHP版本中删除
以下是一些关于准备好的语句的教程,您可以学习并尝试:
- 作用
“$desc”中的最后一个逗号,
<?php require_once('../../config/auth.php');
include "../../config/connection.php";
$rank = $_SESSION['SESS_USER_RANK'];
if ($rank == 0){
header("location: ../../errors/606.php");
exit();
}
$custom = $_POST['name'];
$ulx = $_POST['ulx'];
$price = $_POST['price'];
$desc = $_POST['desc'];
$addrank = "INSERT INTO ranks (rank_name, rank_ulx_name, rank_price, pr_desc)
VALUES ('$custom', '$ulx', '$price', '$desc',)";
mysql_query($addrank);
header("location: ../../editranks.php");
exit();
?>
<h4>Add Custom Rank</h4>
<table class="table table-hover table-hover">
<thead>
<tr>
<th>Rank Name</th>
<th>Ulx Name</th>
<th>Price</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<form method="post" action="functions/admin/addrank.php"><tr>
<td style="width: 14%;"><input class="form-control" type="text" name="name" value=""></td>
<td style="width: 14%;"><input class="form-control" type="text" name="ulx" value=""></td>
<td style="width: 14%;"><input class="form-control" type="text" name="price" value=""></td>
<td style="width: 15%;"><input class="form-control" type="text" name="desc" value=""></td>
<td style="width: 11%;"><input class="btn btn-primary" type="submit" value="Add Rank!"></a></td>
</tr></form>
</tbody>
</table>
另外,请注意SQL注入
使用函数:(我建议您使用并与,或一起使用)
$con
一旦您(希望)转向使用,它就是一个DB连接变量
举个例子
mysql.*
函数已弃用,将从未来的PHP版本中删除
以下是一些关于准备好的语句的教程,您可以学习并尝试:
- 作用
“$desc”中的最后一个逗号,
<?php require_once('../../config/auth.php');
include "../../config/connection.php";
$rank = $_SESSION['SESS_USER_RANK'];
if ($rank == 0){
header("location: ../../errors/606.php");
exit();
}
$custom = $_POST['name'];
$ulx = $_POST['ulx'];
$price = $_POST['price'];
$desc = $_POST['desc'];
$addrank = "INSERT INTO ranks (rank_name, rank_ulx_name, rank_price, pr_desc)
VALUES ('$custom', '$ulx', '$price', '$desc',)";
mysql_query($addrank);
header("location: ../../editranks.php");
exit();
?>
<h4>Add Custom Rank</h4>
<table class="table table-hover table-hover">
<thead>
<tr>
<th>Rank Name</th>
<th>Ulx Name</th>
<th>Price</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<form method="post" action="functions/admin/addrank.php"><tr>
<td style="width: 14%;"><input class="form-control" type="text" name="name" value=""></td>
<td style="width: 14%;"><input class="form-control" type="text" name="ulx" value=""></td>
<td style="width: 14%;"><input class="form-control" type="text" name="price" value=""></td>
<td style="width: 15%;"><input class="form-control" type="text" name="desc" value=""></td>
<td style="width: 11%;"><input class="btn btn-primary" type="submit" value="Add Rank!"></a></td>
</tr></form>
</tbody>
</table>
另外,请注意SQL注入
使用函数:(我建议您使用并与,或一起使用)
$con
一旦您(希望)转向使用,它就是一个DB连接变量
举个例子
mysql.*
函数已弃用,将从未来的PHP版本中删除
以下是一些关于准备好的语句的教程,您可以学习并尝试:
- 作用
“$desc”中的最后一个逗号,
<?php require_once('../../config/auth.php');
include "../../config/connection.php";
$rank = $_SESSION['SESS_USER_RANK'];
if ($rank == 0){
header("location: ../../errors/606.php");
exit();
}
$custom = $_POST['name'];
$ulx = $_POST['ulx'];
$price = $_POST['price'];
$desc = $_POST['desc'];
$addrank = "INSERT INTO ranks (rank_name, rank_ulx_name, rank_price, pr_desc)
VALUES ('$custom', '$ulx', '$price', '$desc',)";
mysql_query($addrank);
header("location: ../../editranks.php");
exit();
?>
<h4>Add Custom Rank</h4>
<table class="table table-hover table-hover">
<thead>
<tr>
<th>Rank Name</th>
<th>Ulx Name</th>
<th>Price</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<form method="post" action="functions/admin/addrank.php"><tr>
<td style="width: 14%;"><input class="form-control" type="text" name="name" value=""></td>
<td style="width: 14%;"><input class="form-control" type="text" name="ulx" value=""></td>
<td style="width: 14%;"><input class="form-control" type="text" name="price" value=""></td>
<td style="width: 15%;"><input class="form-control" type="text" name="desc" value=""></td>
<td style="width: 11%;"><input class="btn btn-primary" type="submit" value="Add Rank!"></a></td>
</tr></form>
</tbody>
</table>
另外,请注意SQL注入
使用函数:(我建议您使用并与,或一起使用)
$con
一旦您(希望)转向使用,它就是一个DB连接变量
举个例子
mysql.*
函数已弃用,将从未来的PHP版本中删除
以下是一些关于准备好的语句的教程,您可以学习并尝试:
- 作用
$result=mysql\u query($addrank)或die(mysql\u error())代码>作为最小错误处理系统。未经验证,请不要将原始输入数据插入数据库。至少,请使用mysql\u real\u escape\u string()函数escape out single quotes。另外,从PHP5.5开始,mysql_*函数已经被弃用。研究使用mysqli或PDO。示例可以在官方PHP手册中看到。我不认为我的代码是完美的xD,正如我所说的,我不是专家,我才刚刚真正开始。谢谢你的评论,我将进行相应的编辑。如果下面为你提供的评论已经解决了你的问题,并且要关闭问题并标记为已回答,请单击白色复选标记,直到它变为绿色@FireGriffin如果没有解决它,请告诉我。您很容易受到攻击,并且只是假设您的代码是完美的。您需要有$result=mysql\u query($addrank)或die(mysql\u error())代码>作为最小错误处理系统。未经验证,请不要将原始输入数据插入数据库。至少,请使用mysql\u real\u escape\u string()函数escape out single quotes。另外,从PHP5.5开始,mysql_*函数已经被弃用。研究使用mysqli或PDO。示例可以在官方PHP手册中看到。我不认为我的代码是完美的xD,正如我所说的,我不是专家,我才刚刚真正开始。谢谢你的评论,我将进行相应的编辑。如果下面为你提供的评论已经解决了你的问题,并且要关闭问题并标记为已回答,请单击白色复选标记,直到它变为绿色@FireGriffin如果没有解决它,请告诉我。您很容易受到攻击,并且只是假设您的代码是完美的。您需要有$result=mysql\u query($addrank)或die(mysql\u error())代码>作为最小错误处理系统。未经验证,请不要将原始输入数据插入数据库。至少,请使用mysql\u real\u escape\u string()函数escape out single quotes。另外,从PHP5.5开始,mysql_*函数已经被弃用。研究使用mysqli或PDO。示例可以在官方PHP手册中看到。我不认为我的代码是完美的xD,正如我所说的,我不是专家,我才刚刚真正开始。谢谢你的评论,我将进行相应的编辑。如果下面为你提供的评论已经解决了你的问题,并且要关闭问题并标记为已回答,请单击白色复选标记,直到它变为绿色@FireGriffin如果它没有解决它,请让我知道。您很容易受到攻击,并且