gpt4 book ai didi

php - 我正在寻找新的更新功能或建议来修复我现有的功能

转载 作者:行者123 更新时间:2023-11-30 01:12:24 25 4
gpt4 key购买 nike

在代码中,我从数据库收集数据,然后根据数据的值更新它。我可以检索这些值,但无法更新它们。我需要有关更新函数或不同类型函数的语法的帮助。

<?php
$con = mysqli_connect("127.0.0.1","root","","timeclock");
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}else{
echo "connected";
}
$x=2;
timein($x);
function timein($x){
$con = mysqli_connect("127.0.0.1","root","","timeclock");
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}else{
echo "connected";
}

$result=mysqli_query($con,"SELECT * FROM emplo`enter code here`yeedatabase WHERE employeeID=$x ORDER BY employeeID" );
while($row = mysqli_fetch_array($result))
{
$inout = $row['inOut'];
}

echo $inout;

if($inout == 1){
echo "hello";
$con = mysqli_connect("127.0.0.1","root","","timeclock");
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}else{
echo "connected";
}
$result=mysqli_query($con,"SELECT * FROM employeedatabase WHERE employeeID=$x ORDER BY employeeID" );
while($row = mysqli_fetch_array($result))
{
$inout = $row['inOut'];
$row['inOut']=2;
}
echo "</table>";

echo $inout;
$outa=2;
mysqli_query($con,"UPDATE employeedatabase SET inOut='$outa' WHERE employeeID='$x'");
}
}

?>-## Heading ##

mysqli 查询函数不起作用,我的 mysqli 函数需要一个新函数或更好的语法。

最佳答案

“不工作”不是很有帮助,在将来的错误以及放入的内容和发生/不发生的情况下是有帮助的。

但看起来这条线需要改变

SELECT * FROM emplo`enter code here`yeedatabase WHERE employeeID=$x ORDER BY employeeID" );

SELECT * FROM employeedatabase WHERE employeeID=$x ORDER BY employeeID" );

关于php - 我正在寻找新的更新功能或建议来修复我现有的功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19369096/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com