Any programmers able to see what I'm fucking up?
This is for a personal project I'm working on.
I should be able to open index.php to display a listing of 'recipes' in the database which will allow me to click through to viewmore.php where i have more information displayed on the page.
PHP Code:
<?php
// change the user_name and password
$db = mysqli_connect("localhost", "dbuser", "dbpass");
// change the database_name
mysqli_select_db("dbname",$db);
$id = $_GET['id'];
$result = mysqli_query($con,"SELECT RecipeID FROM Recipes WHERE id = $id");
echo "<table width=100%>
<tr>
<th>ID</th>
<th>Title</th>
<th>Ingredients</th>
<th>Method</th>
<th>Keywords</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
$id = $row['RecipeID'];
echo "<tr>";
echo "<td>" . $row['RecipeID'] . "</td>";
echo "<td> <a href='viewmore.php?id=$id'>" . $row['Title'] . "</a> </td>";
echo "<td>" . $row['Ingredients'] . "</td>";
echo "<td>" . $row['Method'] . "</td>";
echo "<td>" . $row['Keywords'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
Which should, allow me to generate a link to viewmore.php?id=46 to show the data in the sql for that row, correct?
This is my viewmore.php page code...
PHP Code:
<?php
$id = $_get['id'];
$result = mysqli_query($con,"SELECT * FROM Recipes WHERE RecipeID='$id'");
echo "<table width=100%>
<tr>
<th>Title</th>
<th>Ingredients</th>
<th>Method</th>
<th>Keywords</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td> <a href='#'>" . $row['Title'] . "</a> </td>";
echo "<td>" . $row['Ingredients'] . "</td>";
echo "<td>" . $row['Method'] . "</td>";
echo "<td>" . $row['Keywords'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
I'm sure its a simple issue that I'm missing but I've been up almost 48 hours and my mind just isn't seeing it :/
Any help would be greatly appreciated.