April 5, 2012

Show MySQL Table data in php by id eg index.php?id=24

Question by Daniel Moore

I want to show MYSQL Table data in php by id, so that when someone opens index.php?id=24 it will show all data in row 24.

Answer by Starx

You can get the value of id using

$id = (int)$_GET['id'];

Next, you can use this on your query

$query = "SELECT * FROM `yourtable` WHERE id='$id'";

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!