function MemberTableShow($result) { $rows = mysqli_num_rows($result); echo "<table>"; echo "<table><tr>"; // print headers for ($i = 0; $i < mysqli_num_fields($result); $i++) { $field_info = mysqli_fetch_field_direct($result, $i); echo "<th>{$field_info->name}</th>"; } // print data while ($tableRow = mysqli_fetch_assoc($result)) { echo "<tr>"; $count = 0; $val_array = array(); foreach ($tableRow as $key => $value) { echo "<td>" . $tableRow[$key] . "</td>"; $val_array[$count] = $value; $count++; } ?> <td> <?php if (Can_Update_Members()) { ?> <form method="post" action="update_member.php"> <input type="hidden" name="memberid" value="<?php echo $val_array[0]; ?> "> <input type="hidden" name="rating" value="<?php echo $val_array[1]; ?> "> <input type="hidden" name="phonenumber" value="<?php echo $val_array[2]; ?> "> <input type="hidden" name="firstname" value="<?php echo $val_array[3]; ?> "> <input type="hidden" name="middlename" value="<?php echo $val_array[4]; ?> "> <input type="hidden" name="lastname" value="<?php echo $val_array[5]; ?> "> <input type="hidden" name="renewaldate" value="<?php echo $val_array[6]; ?> "> <input type="hidden" name="streetname" value="<?php echo $val_array[7]; ?> "> <input type="hidden" name="streetnum" value="<?php echo $val_array[8]; ?> "> <input type="hidden" name="datejoined" value="<?php echo $val_array[9]; ?> "> <input type="hidden" name="postalCode" value="<?php echo $val_array[10]; ?> "> <input type="hidden" name="city" value="<?php echo $val_array[11]; ?> "> <input type="hidden" name="password" value="<?php echo $val_array[12]; ?> "> <input type="hidden" name="active" value="<?php echo $val_array[13]; ?> "> <input type='submit' value='Update' name="list_update_btn"/> </form> <?php } ?> </td> <td> <?php if (Can_Delete_Members()) { ?> <form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?> "> <input type="hidden" name="memberid" value="<?php echo $val_array[0]; ?> "> <input type='submit' value='Delete' name="list_delete_btn"/> </form> <?php } ?> </td> <?php echo "</tr>"; } echo "</table>"; }
if (Can_Create_Transaction()) { echo '<a href="../transactionTest.php">Create Transaction</a><br>'; } if (Can_List_Members()) { echo '<a href="../itemTest.php">List Members</a><br>'; } if (Can_Create_Members()) { echo '<a href="create_member.php">Create Members</a><br>'; } if (Can_Update_Members()) { echo '<a href="update_member.php">Update Member</a><br>'; } if (Can_Delete_Members()) { echo '<a href="delete_member.php">Delete Member</a><br>'; } if (Can_Update_Members()) { echo '<a href="inventory.php">Inventory List</a><br>'; } if (Can_Create_Members()) { echo '<a href="addinventory.php">Add Inventory</a><br>'; } if (Can_Create_Members()) { echo '<a href="updateinventory.php">Update Inventory</a><br>'; } if (Can_Create_Transaction()) { echo '<a href="../transactionList.php">Transaction List</a><br>'; } } else { include 'login.php'; } ?>
function MemberTableShow($result) { $rows = mysqli_num_rows($result); echo "<table>"; echo "<table><tr>"; // print headers for ($i = 0; $i < mysqli_num_fields($result); $i++) { $field_info = mysqli_fetch_field_direct($result, $i); echo "<th>{$field_info->name}</th>"; } // print data while ($tableRow = mysqli_fetch_assoc($result)) { echo "<tr>"; $count = 0; $val_array = array(); foreach ($tableRow as $key => $value) { echo "<td>" . $tableRow[$key] . "</td>"; $val_array[$count] = $value; $count++; } ?> <td> <?php if (Can_Update_Members()) { ?> <form method="post" action="updateinventory.php"> <input type="hidden" name="inventorynum" value="<?php echo $val_array[0]; ?> "> <input type="hidden" name="name" value="<?php echo $val_array[1]; ?> "> <input type="hidden" name="price" value="<?php echo $val_array[2]; ?> "> <input type="hidden" name="quantity" value="<?php echo $val_array[3]; ?> "> <input type='submit' value='Update' name="list_update_btn"/> </form> <?php } ?> </td> <td> <?php if (Can_Delete_Members()) { ?> <form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?> "> <input type="hidden" name="inventorynum" value="<?php echo $val_array[0]; ?> "> <input type='submit' value='Delete' name="list_delete_btn"/> </form> <?php } ?> </td> <?php echo "</tr>"; } echo "</table>"; }
function MemberTableShow($result) { require_once 'opendb.php'; require_once 'member/crud.php'; //$rows = TableRetrieve($database, "member"); //$rows = $result; foreach ($result as $row => $value) { echo "<tr>"; $count = 0; $val_array = array(); foreach ($value as $key => $col) { if ($key != "password") { echo "<td>" . $value[$key] . "</td>"; } $val_array[$count] = $value[$key]; $count++; } if (Can_Update_Members()) { ?> <td> <form method="post" action="member/update_member.php"> <input type="hidden" name="memberid" value="<?php echo $val_array[0]; ?> "> <input type="hidden" name="rating" value="<?php echo $val_array[1]; ?> "> <input type="hidden" name="phonenumber" value="<?php echo $val_array[2]; ?> "> <input type="hidden" name="firstname" value="<?php echo $val_array[3]; ?> "> <input type="hidden" name="middlename" value="<?php echo $val_array[4]; ?> "> <input type="hidden" name="lastname" value="<?php echo $val_array[5]; ?> "> <input type="hidden" name="renewaldate" value="<?php echo $val_array[6]; ?> "> <input type="hidden" name="streetname" value="<?php echo $val_array[7]; ?> "> <input type="hidden" name="streetnum" value="<?php echo $val_array[8]; ?> "> <input type="hidden" name="datejoined" value="<?php echo $val_array[9]; ?> "> <input type="hidden" name="postalCode" value="<?php echo $val_array[10]; ?> "> <input type="hidden" name="city" value="<?php echo $val_array[11]; ?> "> <input type="hidden" name="password" value="<?php echo $val_array[12]; ?> "> <input type="hidden" name="active" value="<?php echo $val_array[13]; ?> "> <div class="container"> <input type="submit" class="btn btn- btn-sm" name="list_update_button" value="Update"> </div> </form> </td> <?php echo "</tr>"; } } ?> </tbody> </table> </div> </div> <!-- /container --> </body> </html> <?php }