News Articles in PHP-Part2

Hi ,

Here is the continuation of the News article tutorial in php…. The first part of the article finishes with the inserting the values from the form into database Now we are going to retrieve the data from the database and we have to display that in a separate page.

I already mention about two php files that we are used in the program one is post.php and the other one is news.php where we have used post.php for form design and inserting the values in the database.

Now create a php page in dreamweaver or anyother editor tha you are comfortable with,save it as news.php

Below is the code for retrieving the data from the database

News Column</h1>
//Database commection

mysql_connect(“localhost”,”root”,””) or die(mysql_error());

//selecting database

//select query

$news=mysql_query(“SELECT * FROM news”);
//Retrieving values of all records using while loop

echo ”
$title posted on $date<br>
<hr> “;

I think there is nothing to explain with the code where you can get from my previous posts or frommy comment line used in the  code.If any doubts feel free to contact me….<hr> is the new tag used  for creating horizontal row in your page after each news fetched from the database.


Working For Cause Not For Applause

Tagged with: , , ,
Posted in PHP, web

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: