because we are on the internet.

How to get the content from a database.

After connect php website and database,we will try to get the content from the database,we can create a page which is called content.php.

And we just need to put this code in the <body> </body> part.

<?php

$query_subjects = “SELECT * FROM subjects”;

$query = mysql_query($query_subjects);

if(!$query) {

die(”Database selection failed: ” . mysql_error() );

}

//so we just have get the content from the database subjects table,now we need to display the content on the website.

while($ subject_row = mysql_fetch_array($query)) {

echo $row[menu_name] ;

}

?>

It will get all the meun_name from the database and it will display on your website.

Leave a comment

You must be logged in to post a comment.

 

About Author

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum at arcu. Integer et risus. Morbi id tellus. Integer felis. Mauris malesuada, turpis vitae facilisis euismod, dui arcu adipiscing sem, eu vulputate leo ante in lacus. Sed porta accumsan lectus. Aenean ac sem. In consequat tempus velit. Phasellus leo enim, adipiscing a, egestas nec, pretium ut, pede. Mauris sollicitudin diam et mauris. Sed quis enim vel augue egestas lobortis. Etiam tempus ipsum vel neque.