Forum Moderators: coopster
line 18 = while ($row = mysql_fetch_array($result))
and this is the code of my test.php page :
<html>
<body>
<table>
<?php
$db_host = 'localhost';
$db_user = 'root';
$db_pwd = '';
if (!mysql_connect($db_host, $db_user, $db_pwd))
die("Can't connect to database");
$result = mysql_query("SELECT * FROM MEMBRE WHERE categorie = '" . $_GET['categorie'])
while ($row = mysql_fetch_array($result))
{
echo "<tr><td>" . $row["id"] . "</td><td>" . $row["nom"] . "</td><td>" . $row["age"] . "</td></tr>
}
mysql_close();
?>
</table>
</body>
</html>
You forgot a semi-colon at the end of this line:
$result = mysql_query("SELECT * FROM MEMBRE WHERE categorie = '" . $_GET['categorie']);
echo "<tr><td>" . $row["id"] . "</td><td>" . $row["nom"] . "</td><td>" . $row["age"] . "</td></tr>";
boys and girls are in the column categorie
[edited by: skoff at 6:51 pm (utc) on Nov. 16, 2008]
if(!isset [php.net]($_GET['categorie'])) {
echo 'Category not specified';
die;
}
$result = mysql_query("SELECT * FROM MEMBRE WHERE categorie = '" . mysql_real_escape_string [php.net]($_GET['categorie'])."'");
Definitely read up on mysql_real_escape_string() as it is a VERY important addition to this line. Good luck :)
boys and girls are in the column categorie
If I did all the work for you you will not be learning. :) Try to do your best and if you run into any roadblocks I, or someone else, will be glad to help out.
my database name is test
my table name with the information is membre
i really dont understand...
[edited by: skoff at 7:20 pm (utc) on Nov. 16, 2008]
$result = mysql_query("SELECT * FROM MEMBRE WHERE categorie = '" . mysql_real_escape_string($_GET['categorie'])."'") [b]or die(mysql_error())[/b];
What does this output?
mysql_select_db("test");