Total Pageviews

How to Make a Simple Php News System

Compartilhe:

Hello and welcome to my tutorial!

Now lets get started!

First we may want to make the table in MySQL used to store our news in!

The SQL file looks like this:

paste that into a text document and save it as news.sql (Remember to select "All Files..."

Now lets get started on the system! First we will make the script that gathers the news and outputs them and then we will make the script that adds the news to the database!

Step 1:

Start by creating a file named index.php in your webserver.

In that file we will of course start by writing the PHP opening tags like this:

Step 2:

Now we will connect to our MySQL server by using mysql_connect() and mysql_select_db() like this:

Now we're connected to the database!

Step 3:

Now lets gather the news and output them! Like this:

Posted at ".$r['date']." by ".$r['author'].""; echo $r['content'].""; } ?>

Now we're done with the script outputs the news!

Step 4:

Now lets make the script that inserts the news into the database! It looks like this:

now save that as acp.php.

Now you're done!

Now you have a news system where you can post news from acp.php and see the news you posted on index.php!

Thank you for reading!





iAutoblog the premier autoblogger software
Compartilhe:

Deixe um Comentário:

0 comments: