gpt4 book ai didi

php - 尽管没有错误消息或警告,但插入查询 MySQL 无法正常工作

转载 作者:行者123 更新时间:2023-11-29 02:23:37 25 4
gpt4 key购买 nike

<分区>

由于我是新手,所以想问一下问题。虽然没有出现错误消息,但插入查询似乎无法正常工作。这是代码:

<?php
include "../../inc/inc.koneksi.php";

$table = "admins";

$user = str_replace("'","\'",$_POST['user']);
$pwd = md5($_POST['pwd1']);
$nama = str_replace("'","\'",$_POST['nama']);
$level = $_POST['level'];
$blokir = $_POST['blokir'];

$sql = mysql_query("SELECT username, password, nama_lengkap, level, blokir
FROM $table
WHERE username= '$user'");
$row = mysql_num_rows($sql);
if ($row > 0){
$input = "UPDATE $table SET password ='$pwd',
nama_lengkap ='$nama',
level ='$level',
blokir ='$blokir',
lastupdate = now()
WHERE username= '$user'";

// if(!mysql_query($input));
if ( mysql_query($input) ) {
echo "Record updated successfully.";
} else {
echo "Something went wrong with the query.";
}


} else {
$input = "INSERT INTO $table (username, password, nama_lengkap, level, blokir, create)
VALUES ('".$user."', '".$pwd."', '".$nama."', '".$level."', '".$blokir."', now() )";

//if (!mysql_query($input));
if ( mysql_query($input) ) {
echo "New record created successfully.";
} else {
echo "Something went wrong with the query.";
}
}
echo "<br>".$input."<br/>";
?>

真的需要你的帮助:)

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