Jump to content

[SOLVED] list subjects that are links


patelp7

Recommended Posts

lets exsplain this properly ok

.

 


<?php

//database connection

$db=mysql_connect("localhost","username","password");
mysql_select_db("database_name",$db);

//select statement example ok all book entry's lol.
$query1="select * from books ";
$result=mysql_query(query1);

//while loop to get all the books
while($record=myslq_fetch_assoc($result)){

// echo book information ok title price and a link to see that book information.
echo" ".$record['book_title']," <br> ".$record['price']." <br> 
<a href='read_more.php?id=".$record['id']."'>More Info</a><br><br>";

}

?>

 

Now where going to a page read_more.php to view the book information

and use the id what is in the link to get the book full information.

 

read_more.php

<?php

// database connection
$db=mysql_connect("localhost","username","password");
mysql_select_db("database_name",$db);

//select statement that gets the books from the id in the url.
$query1="select * from books where id=".$_GET[ 'id']." ";
$result=mysql_query($query1);

//read that book we just selected.
while($rec=myslq_fetch_assoc($result)){

// echo book information that was selected.
echo" ".$rec['book_title']." <br> ".$rec['price']." <br> 
".$rec['date_book_was_made']."<br>".$rec['book_description']." <br>";
}

?>

 

now you can see the book that the user selected from a url in the url we use a

varable what was the id of the book then we went to a page and looked at the book

that was selected from the link.

 

That it ok.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.