この関数に問題があります。私はそれが私の質問を書いた方法であるかもしれないと信じています。 "id"と "$ number"は両方とも整数です。PHP関数がmysqliクエリ結果を返しません
誰かが私が間違ってやっていること、あるいはそれを書き込むためのよりよい方法を教えてください。どんな助けでも大いに感謝されるでしょう。
<?php
$number = htmlspecialchars($_GET['id']);
function getrecipeinfo($testing){
global $con;
$sqldescription = "SELECT category, eliquidname, image, contentnicpg, contentnicvg, description FROM vapetable where id = '{$number}' ;";
$result = mysqli_query($con, $sqldescription);
$row = $result->fetch_assoc();
while($row = $result->fetch_assoc()){
$eliquidtitle = $row['eliquidname'];
$category = $row["description"];
print $eliquidtitle;
}
}
getrecipeinfo($testing);
?>
あなたの関数に '$ test'ではなく' $ number'を渡します。 –
あなたはおそらくgetrecipeinfo($ number)を呼び出したいと思うでしょう。 getrecipeinfo($ testing)の代わりに。 – Brett
あなたの関数は決して実際には何も返しません。 – Brett