Is it the right way, and good way to do?
I haven't followed this thread, but that snippet of code, without relation to anything else, has one major problem. It's vulnerable to SQL injection attacks.
Say, for example, someone went to listing_detail.php?id=%3D%27%3Bdrop%20database%20dbname%3Bselect%20*%20from%20movie%20where%20id%3D%27
The query would become:
Code:
$query="SELECT * FROM movie WHERE id='';drop database dbname;select * from movie where id=''";
... which, unless you'd set up the permissions properly (which most people don't bother with), would spell doom for your database.
The solution is:
Code:
$id = mysql_real_escape_string($_GET['id']);
That must be called after mysql_connect().
Bookmarks