royal_lemon
08-20-2006, 01:41 PM
Index.php
<?php
include 'dbconnect.php';
$query="SELECT * FROM news";
$result=mysql_query($query);
while ($row = mysql_fetch_array($result))
{
extract($row);
echo "$title <br />";
echo "$day $month $year <br />";
echo "$entry <br />";
echo "Posted in: $category";
echo "<a href=\"post.php?id=$id\">Permalink</a>";
}
?>
post.php
<?php
$id = $_GET['id'];
include 'dbconnect.php';
$getsignle = mysql_query("SELECT column FROM table
WHERE id = $id");
$row = "mysql_fetch_array($getsingle)";
$title = '$row["title"]';
$entry = '$row["entry"]';
$year = '$row["year"]';
$month = '$row["month"]';
$day = '$row["day"]';
$category = '$row["category"]';
echo "$title <br />";
echo "$tentry <br />";
echo "$day ";
echo "$month ";
echo "$year <br />";
echo "$category";
?>
At index.php, I loop all the columns from the mysql table. I have a link that takes you to post.php?id=$id
At post.php, I want to only display the column where the field id = $id. But when I go to post.php?id=1
I only get this
$row["title"]
$row["day"] $row["month"] $row["year"]
$row["category"]
<?php
include 'dbconnect.php';
$query="SELECT * FROM news";
$result=mysql_query($query);
while ($row = mysql_fetch_array($result))
{
extract($row);
echo "$title <br />";
echo "$day $month $year <br />";
echo "$entry <br />";
echo "Posted in: $category";
echo "<a href=\"post.php?id=$id\">Permalink</a>";
}
?>
post.php
<?php
$id = $_GET['id'];
include 'dbconnect.php';
$getsignle = mysql_query("SELECT column FROM table
WHERE id = $id");
$row = "mysql_fetch_array($getsingle)";
$title = '$row["title"]';
$entry = '$row["entry"]';
$year = '$row["year"]';
$month = '$row["month"]';
$day = '$row["day"]';
$category = '$row["category"]';
echo "$title <br />";
echo "$tentry <br />";
echo "$day ";
echo "$month ";
echo "$year <br />";
echo "$category";
?>
At index.php, I loop all the columns from the mysql table. I have a link that takes you to post.php?id=$id
At post.php, I want to only display the column where the field id = $id. But when I go to post.php?id=1
I only get this
$row["title"]
$row["day"] $row["month"] $row["year"]
$row["category"]