fenzo666 Posted September 27, 2008 Share Posted September 27, 2008 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 https://forums.phpfreaks.com/topic/126086-creating-a-news-section/ Share on other sites More sharing options...
peranha Posted September 27, 2008 Share Posted September 27, 2008 http://www.phpfreaks.com/tutorial/basic-pagination That is what you will want for the pagination part Link to comment https://forums.phpfreaks.com/topic/126086-creating-a-news-section/#findComment-651977 Share on other sites More sharing options...
fenzo666 Posted September 27, 2008 Author Share Posted September 27, 2008 Unfortunately I am a very noob PHP programmer and I don't know where to plug in the codes form that tut. If someone would care to re-write my code with the pagination, it would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/126086-creating-a-news-section/#findComment-651978 Share on other sites More sharing options...
fenzo666 Posted September 27, 2008 Author Share Posted September 27, 2008 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 https://forums.phpfreaks.com/topic/126086-creating-a-news-section/#findComment-651996 Share on other sites More sharing options...
dropfaith Posted September 27, 2008 Share Posted September 27, 2008 http://db.pokesav.org/ isnt your host try localhost or look in the info where you bought your hosting account Link to comment https://forums.phpfreaks.com/topic/126086-creating-a-news-section/#findComment-652030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.