我有一个页面,用户在其中选择具有唯一 ID 的食谱,然后将他们发送到另一个页面,在该页面中显示该食谱的信息,但没有显示任何内容。
$recipes = mysql_query("
SELECT DISTINCT `name`, `step1`, `step2`, `step3`, `image`, `reference`
FROM `recipe` r
INNER JOIN `recipe_ingredients` ri
ON r.id = ri.recipe_id
WHERE ri.ingredient_id IN (".$ingredient1.",".$ingredient2.",".$ingredient3.")
");
这是主页上的查询,它允许用户选择一组成分,然后从中检索食谱。
echo '<form action="recipe.php?id=<?php echo $recipe_id;?>" method="POST">';
echo '<input id="search" name="Look" type="Submit" value="Look" >';
echo '</form>';
在每个配方下都有一个用户按下的按钮,这会将用户发送到特定的配方。
$sql = mysql_query("SELECT `name`, `image`
FROM `recipe`
WHERE `id` = ".$_GET['id']." LIMIT 1");
这是我在结果页面上运行的查询 (recipe.php)
在页面的下方,我运行了这个。
<?php
echo $_GET['id'];
?>
它没有显示 ID,在 url 中我显示了这个:
“recipe.php?id=”
表中有数据,我做错了什么?