Phillip
06-21-2006, 09:42 AM
Ok, i'm building a news system the idea being they can click a link and it will take them to a seperate page which shows the news and the comments.
I plan to have a readfull.php and then have it say the id like this:
www.mywebsite.com/news/showfull.php?id=5
and then in the readfull file have:
$query = "SELECT news FROM where id='$id'";
so here is the script for showing the latest news:
<?php # Show_news.php
// Make the connection.
$dbc = mysql_connect ('localhost', 'phillk_Phillip', 'password', 'phillk_profiles') OR die ('Could not connect to MYSQL: ' . mysql_connect_error());
mysql_select_db("phillk_news",$dbc);
// Make the query.
$query = "SELECT newstitle from WHERE newstitle='$nt'";
$result = mysql_query ($query) or trigger_error ("Query: $query\n<br />Mysql error: " . mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_array ($query)) {
echo "<a href="/news/read_all.php?$row['id']>$row['link_desc']</a>
}
} else { // No recoreds returned.
echo '<p>There is no current news to display!';
}
// Free the result and close the connection.
/*mysql_free_result($result);
mysql_close($dbc); */
?>
is that going to work? thanks
I plan to have a readfull.php and then have it say the id like this:
www.mywebsite.com/news/showfull.php?id=5
and then in the readfull file have:
$query = "SELECT news FROM where id='$id'";
so here is the script for showing the latest news:
<?php # Show_news.php
// Make the connection.
$dbc = mysql_connect ('localhost', 'phillk_Phillip', 'password', 'phillk_profiles') OR die ('Could not connect to MYSQL: ' . mysql_connect_error());
mysql_select_db("phillk_news",$dbc);
// Make the query.
$query = "SELECT newstitle from WHERE newstitle='$nt'";
$result = mysql_query ($query) or trigger_error ("Query: $query\n<br />Mysql error: " . mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_array ($query)) {
echo "<a href="/news/read_all.php?$row['id']>$row['link_desc']</a>
}
} else { // No recoreds returned.
echo '<p>There is no current news to display!';
}
// Free the result and close the connection.
/*mysql_free_result($result);
mysql_close($dbc); */
?>
is that going to work? thanks