PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
First of all, that's TERRIBLY insecure. What if my "ID" was '; DELETE * FROM `table` WHERE '1' = '1...you'd be dead in the water.
The primary reason for your problem, past that, is that you query is returning no data to display. Try echoing the SQL statement and running it in PHPMyAdmin or some other SQL manager.
Jason is right about the security issue. You might be just learning-we all are, but might as well learn to do it right before we let some hack bring down you or your employers entire database.
Try using a while loop and build a $query string.
$query = "SELECT * FROM members WHERE id = '$id'";
$q = mysql_query($query);
while($data = mysql_fetch_array($q)){
The problem wouldn't be with that. The query seems to be designed to only pull one result, so a loop is useless. The code itself appears to be right, but the query is returning nothing.
LSJason wrote:What if my "ID" was '; DELETE * FROM `table` WHERE '1' = '1...you'd be dead in the water.
mysql_query() sends an unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified link_identifier .
Though, I must agree that hansford's code is insecure.
There are 10 types of people in this world, those who understand binary and those who don't