Friday, February 7, 2014

Tute 16 : Html details page Make dynamic

If we click this line go to the details page. But it would not work properly. Because we do not finished our work in details page. So we go to the detailspage.php in notepad++ and will some change.


At top after the require line we write a new line. This line is here :

------------------------------------
$n_id=$_GET['id'];
-----------------------------------

pic

This line we create a new variable name $n_id. This variable equile which id get this page about GET Method.

Now we some edit $sql line. Write '".$n_id."' Code after id=

Before this line

$sql="SELECT `id`, `heading`, `details`, `image` FROM tute WHERE id='".$n_id."'";

After edit this line

$sql="SELECT `id`, `heading`, `details`, `image` FROM tute WHERE id='".$n_id."'";

Go to the detailspage.php in chrome and refresh this. Nothing happened. So we will go to our homepage and click any headline. We see the address bar a big url like this : http://localhost/tute/detailspage.php?id=4

Back to our home page and click another headline. Again automatically browser go to the detailspage with another article. Again see the url. Here another id number. This is our article id number who create mysql database and increase auto.

pic

No comments :

Post a Comment