I would ask for any help, because Im desperate :D. I need help with my school project, where I have to save data from form. There´s one select, where should be dropdown with datas from another connected table.
here is screenshot of my relations:
<?php $con = mysql_connect("localhost","root",""); $db = mysql_select_db("cznovis",$con); $get=mysql_query("SELECT id FROM listky); $option = ''; while($row = mysql_fetch_assoc($get)) { $option .= '<option value = "'.$row['id'].'">'.$row['id'].'</option>'; } ?> <form action="odeslat.php" method="POST"> <select name="typ"> <?php echo $option; ?> </select> <input type="submit" name="odeslat" value="ODESLAT"> </form>
i would appreciate any help
Simple usein join should be enough. Your query shoul by like this:
select * from clenstvi as cl join listky as li on cl.typ=listky.id;
you can use left outer join in your query
select * from table1 left outer join table2 on table1.id = table2.id;
and then concatenate those two columns in your select
$row['data1'].$row['data2'];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.