dannyone Posted March 29, 2009 Share Posted March 29, 2009 Hey, i have used phpmyadmin and my query works fine and displays all the correct records. however now i am trying to show them in html and its seems that it isn't storing some of the values i am selecting. il show you my code so i can explain better $days = array('mon' => '', 'tue' => '', 'wed' => '', 'thu' => '', 'fri' => ''); // Add our list of days to our time slots $times = array( '9-10' => $days, '10-11' => $days, '11-12' => $days, '12-1' => $days, '1-2' => $days, '2-3' => $days, '3-4' => $days); // Connect to DB and run our query $sql = new mysqli('localhost', 'danny', 'danny', 'tutorial'); $run = $sql->query("SELECT Marker_Rooms.Room_ID2, Rooms_Free.Room_ID, Rooms_Free.timeslot, Rooms_Free.day, Rooms_Free.status FROM Marker_Rooms, Rooms_Free WHERE Marker_ID = '101' AND Marker_Rooms.Room_ID = Rooms_Free.Room_ID AND Rooms_Free.status = '0' UNION SELECT Marker_Rooms.Room_ID1, Rooms_Free.Room_ID, Rooms_Free.timeslot, Rooms_Free.day, Rooms_Free.status FROM Marker_Rooms, Rooms_Free WHERE Marker_ID = '101' AND Marker_Rooms.Room_ID1 = Rooms_Free.Room_ID AND Rooms_Free.status = '0' UNION SELECT Marker_Rooms.Room_ID2, Rooms_Free.Room_ID, Rooms_Free.timeslot, Rooms_Free.day, Rooms_Free.status FROM Marker_Rooms, Rooms_Free WHERE Marker_ID = '101' AND Marker_Rooms.Room_ID2 = Rooms_Free.Room_ID AND Rooms_Free.status = '0'"); while($row = $run->fetch_object()) { $times[$row->timeslot][$row->day] = "<input type=radio name=radio[] id=radio[] value= $row->id/> $row->Room_ID <br> <input type=radio name=radio[] id=radio[] value= $row->id/> $row->Room_ID1 <br> <input type=radio name=radio[] id=radio[] value= $row->id/> $row->Room_ID2"; //////////////////////////////////////////////////////////////// above is my problem! } $body = <<< endBody <center> <table align="center" border="1" cellspacing="0" cellpadding="1"> <tr> <th align="center">Time</th> <th align="center">Monday</th> <th align="center">Tuesday</th> <th align="center">Wednesday</th> <th align="center">Thursday</th> <th align="center">Friday</th> </tr> endBody; // For each time slot, check each day for a value // If one exists, display it, if not, display an empty table data (<td>) foreach($times as $timeslot => $day) { $body .= "\n\t\t<tr>\n\t\t\t<td>$timeslot</td>"; foreach($day as $course) { $td = (strlen($course) > 0) ? $course : ' '; $body .= "\n\t\t\t<td>$td</td>"; } $body .= "\n\t\t</tr>"; } $body .= "\n\t</table>\n</center"; ?> <?=$body?> i am trying to show all the Room_ID's with a radio button that have status 0. however it doesn't work, it just show Room_ID, not Room_ID1 or Room_ID2. i have tried just using Room_ID1 and nothing appears so i guess im not selecting it properly. does any1 have any ideas? Thanks Link to comment https://forums.phpfreaks.com/topic/151636-help-displaying-all-records-selected/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.