Search the Community
Showing results for tags 'php and sql'.
-
hello people my code is displaying the last result instead of the exact result i requested for. Here is my code <table width="800" height="40" align="center"> <form action="admin-edit-room.php" method="post"> <?php $object->database(); $object->set_sqlstr(htmlspecialchars( "SELECT `cat`.*,`rooms`.* FROM `cat`,`rooms` WHERE `cat`.`id` = `rooms`.`catid` ") ); // $object->set_sqlstr("SELECT * FROM `rooms` " ); $object->querydata(); $num = $object->no_rows; if($num=0){echo "Your inbox is empty";} $i=1; while($object->data[0]!= ""){ $class = (($i%2)==0) ? 'td_colour1' : 'td_colour2'; echo'<tr class="'.$class.'">'; echo'<td width="50" height="10" class="admin-details-form" align="left">'. $object->data['room-name'] .'</td>'; echo'<td width="200" height="10" class="admin-details-form" align="left">'. $object->data['room-descript'] .'</td>'; echo'<td width="200" height="10" class="admin-details-form" align="left"><input type="hidden" name="roomid" value="'.$object->data['roomid'].'" />'.$object->data['catid'].'</td>'; echo'<td width="200" height="10" class="admin-details-form" align="left"><input type="hidden" name="catid" value="'.$object->data['catid'].'" /></td>'; echo'<td width="10" height="10" class="admin-details-form" align="center"><input type="submit" name="edit" value="Edit" /></td>'; echo'</tr>'; $object->fetchdata(); $i++; } ?> </form> </table> Now the thing is i placed "roomid" inside an hidden field and submited it to the next transaction page as you can see but instead of it submiting the specific id it keeps submiting the last roomid, please what could be the problem? thanks