Jump to content

Creating a News Section


fenzo666

Recommended Posts

So basically I want to create a news section for my site. I have something VERY basic so far: http://db.pokesav.org/news.php

No news yet, but I want to make it as appealing as possible. I also want the page to automatically input when and who put the article for the news. For example:

"Crazy Lion eats Man"

09/18/09 - fenzo666

      Today, a man was attacked by a giant lion...

I also need to add the function that sets a cap on the number of articles. For instance, if I have 10 articles per page, and I have 50 articles in total, there will be a navigation toolbar of some sort to flip through the pages. Here is what I have so far:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>The PKM Database</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Your website description goes here" />
<meta name="keywords" content="your,keywords,goes,here" />
<link rel="stylesheet" href="include/style.css" type="text/css" media="screen,projection" />
</head>

<body>
<?php include("include/header.php"); ?>
<div id="container" >
<div id="header">
<h1>The PKM Database</h1>
<h2>Where Pokémon meet Pokésav!</h2>
</div>

<div id="navigation">
<ul>
<li class="selected"><a href="news.php">News</a></li>
<li><a href="index.php?:A">Numb.</a></li>
<li><a href="index.php?name:A">Name</a></li>
<li><a href="event.php">Events</a></li>
<li><a href="video.php">Videos</a></li>
<li><a href="other.php">Other</a></li>
<li><a href="help.php">Help</a></li>
<li><a href="about.php">About</a></li>
<li><a href="/upload">Upload</a></li>
</ul>
</div>

<div id="content">
<h2><h2 align=center><font color="#467AA7"><b>The PKM DB News!</b></font></h2></h2>
<p>
<?php include("include/pages/news.html"); ?>
</p>
</div>

<?php include("include/sidebar.php"); ?>

<div id="footer">
<p>
<?php
$year = date("Y",time ()); 
if ( $year != "2008" ) {
echo "© 2008 - ".$year;
}
else {
echo "© 2008";
}
?> <a href="#">Bao Trinh</a> | Last updated: <?php echo date('j F Y', getlastmod()); ?></p>
</div>

</div>
</body>
</html>

 

Thanks so much for your help guys!

 

-fenzo666

Link to comment
Share on other sites

Well, I inputted the code and this is the error I get.



Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'http' (1) in /home/content/b/a/o/baohuahuang/html/db/news.php on line 12

 

Fatal error: SQL in /home/content/b/a/o/baohuahuang/html/db/news.php on line 12

 

<?php
$conn = mysql_connect('http://db.pokesav.org/','fenzo666','PASSWORD') or trigger_error("SQL", E_USER_ERROR); //this is line 12
$db = mysql_select_db('fenzo666',$conn) or trigger_error("SQL", E_USER_ERROR);

for ($x = 0; $x < 106; $x++) {
   $number = rand(100,999);
   $sql = "INSERT INTO numbers (number, id) VALUES ($number, '')";
   $query = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
}
?>
<?php
// database connection info
$conn = mysql_connect('http://db.pokesav.org/','fenzo666','PASSWORD') or trigger_error("SQL", E_USER_ERROR);
$db = mysql_select_db('fenzo666',$conn) or trigger_error("SQL", E_USER_ERROR);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.