News Posting Script Help Needed...!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mlauzon
Forum Newbie
Posts: 4
Joined: Tue Oct 21, 2003 11:59 am
Location: Ottawa, Ontario, Canada, North America, Planet Earth, Sol System, Milky Way Galaxy, Universe

News Posting Script Help Needed...!

Post by mlauzon »

Someone sent me a news posting script to use, the problem is he was supposed to update the script to archive posts made to it, as well as tell me how to install it. If you remember, I needed a script to post news to the index page of my site, this still needs to be done, but to post news to that page, it must post to the centre of the page because there's a good chance that I'll have a menu bar down one side as well as maybe an ad banner down the opposite side. If anyone can help, I'll send them the script that was sent to me. Thanks.

the name of the database -- I do not know how to setup a database -- will of course need to be changed:

Code: Select all

<table width="28%" height="254" border="4" cellpadding="0" cellspacing="0" bordercolor="#006699"> 
<tr> 
<td> <form name="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> 
<h2><b>Add News Story</b></h2> 


</td> 

<tr> 
<td>Author: </td> 
</tr> 
<tr> 
<td><input type=text name="auth" size=40> </td> 
</tr> 
<tr> 
<td>Headline:</td> 
</tr> 
<tr> 
<td><input type=text name="title" size=40></td> 
</tr> 
<tr> 
<td>News Story: </td> 
</tr> 
<tr> 
<td><textarea name="news" rows=5 cols=30></textarea></td> 
</tr> 
<tr> 
<td><input name="submit" type=submit value="ADD"></td> 
</tr> 
</table> 
</form> 
<? 
$date=date("F j, Y"); 
if(!$auth||!title||!news||!$date) 
{ 
echo "ERROR: Not all fields have been entered please try again!"; 
exit; 
} 
else 
{ 

@ $db=mysql_pconnect($host,$user,$pass)or die("Could not connect to host\n"); 
mysql_select_db("tribals_joe")or die("Could not connect to databse\n"); 
$query_insert="INSERT into news (auth,title,news,date)Values("$auth","$title","$news","$date")"; 
mysql_query("$query_insert") or die("query_insert failed"); 
} 
$query_count = "SELECT count(id) from slhnews"; 
$query_select = "SELECT id FROM news ORDER BY id LIMIT 1;"; 
$result3 = mysql_query($query_count) or die("query_count failed"); 
while ($count = mysql_fetch_array($result3)) 
{ 

$num=$count['count(id)']; 
} 

?>
mlauzon
Forum Newbie
Posts: 4
Joined: Tue Oct 21, 2003 11:59 am
Location: Ottawa, Ontario, Canada, North America, Planet Earth, Sol System, Milky Way Galaxy, Universe

Post by mlauzon »

Top...!
Post Reply