mysql - 我怎样才能让 mysql_query 再次工作?
问题描述
网站主机升级到 php 7
编码
else{
$insert="Insert into voedselinfo(voedselnaam,Eenheid,Kcal,Eiwit,Koolh,Vet)
values('".$voedselnaam."','".$Eenheid."','".$Kcal."','".$Eiwit."','".$Vet."','".$Koolh."')";
$rs=mysql_query($insert) or die(mysql_error());
?>
<script>alert('Data Entry Saved!');</script>
<?php }
}
}
?>
不再工作了....
应该是吗?
else{
$insert="Insert into voedselinfo(voedselnaam,Eenheid,Kcal,Eiwit,Koolh,Vet)
values('".$voedselnaam."','".$Eenheid."','".$Kcal."','".$Eiwit."','".$Vet."','".$Koolh."')";
$rs=mysqli_query($insert) or die(mysqli_error());
?>
<script>alert('Data Entry Saved!');</script>
<?php }
}
}
?>
但似乎也不起作用,警报不再出现,没有任何反应......
<!DOCTYPE html>
<head>
<title>Voedsel toevoegen bug 6</title>
<!-- Bootstrap -->
<link href="css/bootstrap.css" rel="stylesheet">
<script src="js/bootstrap.min.js"></script>
</head>
<body>
<br><br>
<h3>Controleer dat de waarden correct naar het overzicht (View Data) worden overgezet.<h3>
<div class="left">
<form class="span4" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset>
<legend>Voedsel toevoegen</legend>
<label>voedselnaam<span class="required">*</span></label>
<input type="text" name="voedselnaam" class="input-xlarge" placeholder="voedselnaam" value="<?php if(isset($_POST['voedselnaam'])){ echo $_POST['voedselnaam']; }?>" autofocus>
<label>Eenheid<span class="required">*</span></label>
<input type="text" name="Eenheid" class="input-small" placeholder="" value="<?php if(isset($_POST['Eenheid'])){ echo $_POST['Eenheid']; }?>">
<br/>
<label>Kcal<span class="required">*</span></label>
<input type="text" name="Kcal" class="input-small" placeholder="" value="<?php if(isset($_POST['Kcal'])){ echo $_POST['Kcal']; }?>">
<br/>
<label>Eiwitten<span class="required">*</span></label>
<input type="text" name="Eiwit" class="input-small" placeholder="" value="<?php if(isset($_POST['Eiwit'])){ echo $_POST['Eiwit']; }?>">
<br/>
<label>Koolh.<span class="required">*</span></label>
<input type="text" name="Koolh" class="input-small" placeholder="" value="<?php if(isset($_POST['Koolh'])){ echo $_POST['Koolh']; }?>">
<br/>
<label>Vet<span class="required">*</span></label>
<input type="text" name="Vet" class="input-small" placeholder="" value="<?php if(isset($_POST['Vet'])){ echo $_POST['Vet']; }?>">
<?php
if(isset($_POST['getdata'])){
$conn=mysqli_connect('localhost','masked','masked01');
mysqli_select_db("database",$conn);
// $regexp = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/";
$voedselnaam=$_POST['voedselnaam'];
$Eenheid=$_POST['Eenheid'];
$Kcal=$_POST['Kcal'];
$Eiwit=$_POST['Eiwit'];
$Koolh.=$_POST['Koolh'];
$Vet=$_POST['Vet'];
$var=mt_rand(0,1);
if($var == 1 || 0) {
if($Vet >15 && $Eiwit >10)
{
echo "<label class='err'>You found bug#3: The system crashes by testing this way. Great Job!</label>";
}
elseif($Vet ==15 && $Eiwit ==10)
{
echo "<label class='err'>You found bug#4: Boundry value analyses. (only in combination of both boundry) Great Job!</label>";
}
elseif($Vet >15)
{
echo "<label class='err'>You found bug#2: Fat bigger then 15</label>";
}
elseif($Eiwit >10)
{
echo "<label class='err'>You found bug#1: Eiwit bigger then 10 </label>";
}
else{
$insert="Insert into voedselinfo(voedselnaam,Eenheid,Kcal,Eiwit,Koolh,Vet)
values('".$voedselnaam."','".$Eenheid."','".$Kcal."','".$Eiwit."','".$Vet."','".$Koolh."')";
$rs=mysql_query($insert) or die(mysql_error());
?>
<script>alert('Data Entry Saved!');</script>
<?php }
}
}
?>
<br/> <button type="submit" name="getdata" class="btn">Submit</button>
<a href="http://www.testenvansoftware.nl/test8/voedselinfo.php" class="btn btn-primary">View Data</a>
</fieldset>
</form>
</div>
<?php
function save(){
}
?>
</body>
</html>
解决方案
推荐阅读
- java - 改进 log4j 中的细节打印
- tensorflow - Tensorflow 错误:传递给 Dataset.map() 的函数的返回值不受支持
- wordpress - Wordpress 将所有 URL 破坏为无效的损坏 URL
- boolean - 在 CPLEX 中创建布尔约束
- xml - 特殊字符的 XSD 架构 - Excel 导入
- java - Making block/Character move "X px" when "W or w" is only once when pressed, and not continue walking when "W and w" is held down
- angular - 我们可以为 ngx-datatable-column 指定 id 以以唯一的方式识别它吗?
- ios - 如何在 Visual Studio Xamarin 表单中将帐户添加到“Apple 开发人员帐户”?
- c# - WPF C# - 不正确的鼠标位置坐标
- javascript - Django中的一个表单和ajax中的两个提交输入