私は常に警告 mysqli_fetch_array() がパラメーター 1 が mysqli_result であると予想し、ブール値が指定されていることを期待しています....配列項目を一重引用符で囲んでいないためだと思います。どうすればいいですか?このコードをより良く/より賢く/より安全にする(SQLインジェクション)ための提案はありますか?私はこれが初めてです..ありがとう
これは「jsonでjqueryから配列を取得しています」というコードです
<?php
include_once("dbconx.php");
$json = $_POST['cats'];
$json_string = stripslashes($json);
$data = json_decode($json_string, true);
echo "<pre>";
print_r($data);
$th= "";
for($i=0; $i < count($data); $i++)
{
$th .= $data[$i].',';
}
$th = rtrim($th, ",");
echo $th;
$sql = "SELECT * FROM themes WHERE theme IN ($th)";
$query = mysqli_query($db_conx, $sql);
while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
}
?>
助けてくれてありがとう