/me imagine the bubble petruding from Az's head "oh not another one from kez"
Ok, this will probably be second to last title for my database on my site.
Now i've decided to ditch tutorials and reviews 'cause we all know why so i'm just sticking with articles. No you can't know what the articles section is going to contain until it's there
Right, so two files. Reminder i'm using a switch. One to pre-view the information and one to view the content.
File one, to pre-view.
File read_article.php to display the content.PHP Code:<?php
$link = mysql_connect("localhost", kez", "kez")
or die("Could not connect : " . mysql_error());
mysql_select_db("kez") or die("Could not select database");
$result = mysql_query("SELECT ID,title,creation_date,explanation FROM `items` ORDER BY title ASC", $link);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<a href=\"article.php?page=read_tutorials" . "&id=" . $line['ID'] . "\">" . $line['title'] .
"</a>: " . $line['creation_date'] . "<br />" . $line['explanation'];
;
}
mysql_close();
?>
These are my own concuctions so i expect there to be lots of nasty errors.PHP Code:<?php
if (!is_null($id)) {
$link = mysql_connect("localhost", "kez", "kez") OR DIE("Awww, can't connect to the database :(");
mysql_select_db("kez");
$result = mysql_query("SELECT * FROM `item_pages` WHERE ID='$id' LIMIT 0,1", $link);
$line = mysql_fetch_array($result, MYSQL_ASSOC);
echo "<div id=\title\>" . $line['title'] . "</div>" . $line['creation_date'];
<P>" . $line['content'] . "</P>";
} else {
echo "Can't display data.";
}
?>
Is this the correct method to do it? If not, is there a better way to do it *kez mumbles function* or is there something i'm doing completely wrong.


LinkBack URL
About LinkBacks
Reply With Quote


