I have this database and I need to display data from koncerti (koncertnaziv,karte,mesto,datum) based on what grupanaziv is sleceted before, and grupanaziv is in different table called grupe, grupa_id from koncerti has same id as id from grupe, so that is connected in that way,
so I need to match grupanaziv that user choosed as option and its id from grupe is same as grupa_id from koncerti, and display data from koncerti for that id, I need help with that
I am thinking of something like this
Select * From koncerti WHERE grupa_id (part which I dont know) MATCHES id FROM grupe (for previously selected grupanaziv) (and display koncertnaziv,mesto,datum,karte for that id FROM koncerti)
//Tabela Sections
$sql = "CREATE TABLE grupe
(
ID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(ID),
grupanaziv varchar(64)
)";
mysql_query($sql,$con);
echo "Table grupe CREATED!<br>";
//Tabela Subjects
$sql = "CREATE TABLE koncerti
(
ID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(ID),
koncertnaziv varchar(64),
karte int(10),
mesto varchar(64),
datum DATE,
grupa_id int(6)
)";
mysql_query($sql,$con);
echo "Table koncerti CREATED!<br>";
here is code where user have to choose option
<p align="center"><font color="#0000FF">Pregled grupa</font></p>
<p align="center">Grupa kojoj koncert pripada:
<select name="grupa_select" id="grupa_select">
<?php
while($row = mysql_fetch_array($sql))
{
echo "<option>".$row['grupanaziv']."</option>";
}
?>
</select>
</p>
<p align="center">
<input type="submit" name="pregled_grupe" id="pregled_grupe" value="- Izaberi grupu-" />
</p>
<p>
<label></label>
</p>
thanks in advance