php - MYSQL INNER JOINS -
i have 2 tables in database. 1 used booking selection of dates , times available , other used returning selection of dates , times available. need link these 2 on 1 page.
<?php { mysql_connect("localhost" , "" , "") or die (mysql_error()); mysql_select_db("") or die(mysql_error()); $pid=intval($_session["user_id"]); $query = "select t1.*, t2.return_time, t2.return_date returnout t1 inner join return t2 on t1.book_time=t2.book_time"; //executes query on database $result = mysql_query ($query) or die ("didn't query"); //this selects results rows $num = mysql_num_rows ($result); $dates_and_times = array(); while($row=mysql_fetch_assoc($result)) { $dates_and_times[] = $row['book_date'].' '.$row['book_time']; $dates_and_times[] = $row['return_date'].' '.$row['retun_time']; } } ?> <form method="post" action="booked.php"> <strong>dates available</strong> <select id="date" name="date"> <option value="0">--select date--</option> <?php foreach ($dates_and_times $app_date) { ?> <option value="<?php echo $app_date; ?>"><?php echo $app_date; ?></option> <?php } ?> </select>
so need have 2 forms, 1 displaying dates , times booking , other returning. have gone wrong somewhere inner joins. ideas?
thanks!
Comments
Post a Comment