gpt4 book ai didi

php - 为什么我的查询不起作用?

转载 作者:行者123 更新时间:2023-11-29 18:40:44 25 4
gpt4 key购买 nike

我刚刚创建了一个 .php 文件,不幸的是我的 sql 查询无法在我的虚拟主机上运行,​​但 .php 文件运行良好。所以问题是,我的 sql 查询无法执行

它说:

Post Gagal or Post failed (in english)

你能告诉我为什么我有一个sql错误以及如何修复这个错误

this my php code

                        date_default_timezone_set("Asia/Bangkok");
ob_start();
session_start();
require 'connection.php';

// if session is not set this will redirect to login page
if( !isset($_SESSION['user']) ) {
header("Location: loginpanel.php");
exit;
}
// select loggedin users detail
$res=mysqli_query($conn,"SELECT * FROM akun_admin WHERE idadmin=".$_SESSION['user']);
$userRow=mysqli_fetch_array($res);

if ( isset($_POST['btn-post']) ) {
$error = false;
// clean user inputs to prevent sql injections
$jd = trim($_POST['jd']);
$jd = strip_tags($jd);

$sa = trim($_POST['sa']);
$sa = strip_tags($sa);

$note = trim($_POST['note']);
$note = strip_tags($note);

$genre = trim($_POST['genre']);
$genre = strip_tags($genre);

$ps = trim($_POST['ps']);
$ps = strip_tags($ps);

$ep14 = trim($_POST['1Link480p']);
$ep17 = trim($_POST['1Link720p']);
$ep1 = trim($ep14.'-'.$ep17);
$ep1 = strip_tags($ep1);

$ep24 = trim($_POST['2Link480p']);
$ep27 = trim($_POST['2Link720p']);
$ep2 = trim($ep24.'-'.$ep27);
$ep2 = strip_tags($ep2);

$ep34 = trim($_POST['3Link480p']);
$ep37 = trim($_POST['3Link720p']);
$ep3 = trim($ep34.'-'.$ep37);
$ep3 = strip_tags($ep3);

$ep44 = trim($_POST['4Link480p']);
$ep47 = trim($_POST['4Link720p']);
$ep4 = trim($ep44.'-'.$ep47);
$ep4 = strip_tags($ep4);

$ep54 = trim($_POST['5Link480p']);
$ep57 = trim($_POST['5Link720p']);
$ep5 = trim($ep54.'-'.$ep57);
$ep5 = strip_tags($ep5);

$ep64 = trim($_POST['6Link480p']);
$ep67 = trim($_POST['6Link720p']);
$ep6 = trim($ep64.'-'.$ep67);
$ep6 = strip_tags($ep6);

$ep74 = trim($_POST['7Link480p']);
$ep77 = trim($_POST['7Link720p']);
$ep7 = trim($ep74.'-'.$ep77);
$ep7 = strip_tags($ep7);

$ep84 = trim($_POST['8Link480p']);
$ep87 = trim($_POST['8Link720p']);
$ep8 = trim($ep84.'-'.$ep87);
$ep8 = strip_tags($ep8);

$ep94 = trim($_POST['9Link480p']);
$ep97 = trim($_POST['9Link720p']);
$ep9 = trim($ep94.'-'.$ep97);
$ep9 = strip_tags($ep9);

$ep104 = trim($_POST['10Link480p']);
$ep107 = trim($_POST['10Link720p']);
$ep10 = trim($ep104.'-'.$ep107);
$ep10 = strip_tags($ep10);

$ep114 = trim($_POST['11Link480p']);
$ep117 = trim($_POST['11Link720p']);
$ep11 = trim($ep114.'-'.$ep117);
$ep11 = strip_tags($ep11);

$ep124 = trim($_POST['12Link480p']);
$ep127 = trim($_POST['12Link720p']);
$ep12 = trim($ep124.'-'.$ep127);
$ep12 = strip_tags($ep12);

$ep134 = trim($_POST['13Link480p']);
$ep137 = trim($_POST['13Link720p']);
$ep13 = trim($ep134.'-'.$ep137);
$ep13 = strip_tags($ep13);

$ep144 = trim($_POST['14Link480p']);
$ep147 = trim($_POST['14Link720p']);
$ep14 = trim($ep144.'-'.$ep147);
$ep14 = strip_tags($ep14);

$ep154 = trim($_POST['15Link480p']);
$ep157 = trim($_POST['15Link720p']);
$ep15 = trim($ep154.'-'.$ep157);
$ep15 = strip_tags($ep15);

$ep164 = trim($_POST['16Link480p']);
$ep167 = trim($_POST['16Link720p']);
$ep16 = trim($ep164.'-'.$ep167);
$ep16 = strip_tags($ep16);

$ep174 = trim($_POST['17Link480p']);
$ep177 = trim($_POST['17Link720p']);
$ep17 = trim($ep174.'-'.$ep177);
$ep17 = strip_tags($ep17);

$ep184 = trim($_POST['18Link480p']);
$ep187 = trim($_POST['18Link720p']);
$ep18 = trim($ep184.'-'.$ep187);
$ep18 = strip_tags($ep18);

$ep194 = trim($_POST['19Link480p']);
$ep197 = trim($_POST['19Link720p']);
$ep19 = trim($ep194.'-'.$ep197);
$ep19 = strip_tags($ep19);

$ep204 = trim($_POST['20Link480p']);
$ep207 = trim($_POST['20Link720p']);
$ep20 = trim($ep204.'-'.$ep207);
$ep20 = strip_tags($ep20);

$ep214 = trim($_POST['21Link480p']);
$ep217 = trim($_POST['21Link720p']);
$ep21 = trim($ep214.'-'.$ep217);
$ep21 = strip_tags($ep21);

$ep224 = trim($_POST['22Link480p']);
$ep227 = trim($_POST['22Link720p']);
$ep22 = trim($ep224.'-'.$ep227);
$ep22 = strip_tags($ep22);

$ep234 = trim($_POST['23Link480p']);
$ep237 = trim($_POST['23Link720p']);
$ep23 = trim($ep234.'-'.$ep237);
$ep23 = strip_tags($ep23);

$ep244 = trim($_POST['24Link480p']);
$ep247 = trim($_POST['24Link720p']);
$ep24 = trim($ep244.'-'.$ep247);
$ep24 = strip_tags($ep24);

$tp = date("Y-m-d");
$wp = date("h:i:sa");

$ap = $userRow['alias'];

function generateRandomString($length = 50) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
$postID = generateRandomString();
// if there's no error, continue to signup
if(!empty($jd)) {
$res = mysqli_query($conn,"INSERT INTO postperepisode1_12 (idpost, judulpost, tanggal, waktu, adminposting, genre, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1`, 18, 19, 20, 21, 22, 23, 24, note, sinopsis) VALUES ('$postID', '$jd', '$tp', '$wp', '$ap', '$genre', '$ep1', '$ep2', '$ep3', '$ep4', '$ep5', '$ep6', '$ep7', '$ep8', '$ep9', '$ep10', '$ep11', '$ep12', '$ep13', '$ep14', '$ep15', '$ep16', '$ep17', '$ep18', '$ep19', '$ep20', '$ep21', '$ep22', '$ep23', '$ep24', '$sa', '$note')");

if ($res) {
$errTyp = "success";
$errMSG = "Posting Berhasil";
} else {
$errTyp = "danger";
$errMSG = "Post Gagal";
}

}


}
?>

最佳答案

是的,我明白了,但这是你的自定义错误,也许你可以打印你的sql并执行
mysql 客户端。你可以先检查mysqli_error($conn)

关于php - 为什么我的查询不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44961592/

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