- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我刚刚创建了一个 .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/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!