Fred007 Fred007 - 2 months ago 6
MySQL Question

Php-Myql: select every row with same specific value

I tried to made an autofilling html table that add or remove its rows with database. But now I need to make that the table will fill in only those rows with specific "Domain" column. For example, I have 3 table rows and in 2 of them, "domain" colum's value is "1" and the third row has "domain" column value of 1. I need to my php code to automatically choose only those rows with "1" value in "Domain" column and ignore the others. So when I add more rows to my database, the html table will only take those rows with 1 specific value.



$server = mysql_connect("localhost", "admin", "admin");
$db = mysql_select_db("rpo", $server);
$query = mysql_query("SELECT * FROM suhrn");


while ($row = mysql_fetch_array($query)) {
<td> <?php echo $row['Popis']; ?> </td>
<td> <?php echo $row['Typ']; ?> </td>
<td> <?php echo $row['Zobrazit']; ?> </td>
<td> <?php echo $row['Domena']; ?> </td>


I'm not sure if I understood your problem, but maybe a slight modification to your SQL-Statement should do the trick.

SELECT * FROM suhrn WHERE col_domain = 1;

Hope that helps