
Markob1984
New Members-
Posts
7 -
Joined
-
Last visited
Markob1984's Achievements

Newbie (1/5)
0
Reputation
-
i have 38 records in the database but its showing 38 but 2 of them are duplicates and it isnt showing the newest record added until i add a new record?
-
Im having a problem with my pagination code when i add a new record it isn't showing it and it shows the second last one again page 1 page 2 the top record is a duplicate of the 3rd one down of the image above and isnt showing the last record because of this can anyone help please below is the code <?php include('styles/top.php'); ?> <div id="left"> <?php if ($user_level !=1){ } else { include("css/menu.php"); ?> <?php } ?> </div> <div id="right"> <div id="view_box"> <ul> <li><img src="images/1.png" /></li> <!-- <li><img src="pics/2.jpg" /></li> --> <!-- <li><img src="pics/3.jpg" /></li> --> </ul> </div> <div id="button"> <ul> <!-- <li><button class="button" scroll_value="0">*</button></li> -- > <!-- <li><button class="button" scroll_value="600">*</button></li> --> <!-- <li><button class="button" scroll_value="1200">*</button></li> --> </ul> </div> <hr /> <?php if ($user_level !=1){ echo "No Access Allowed Admin Only "; } else { if(isset($_GET['page'])){ $page = $_GET['page']; } else { $page = 1; } if($page == '' || $page == 1){ $page1 = 0; } else { $page1 = ($page*4)-4; } $sql = "SELECT * FROM orders where orderby='Mark' ORDER By str_to_date(`paydate`, '%d/%m/%Y') ASC LIMIT ".$page1.", 4"; $data = $con->query($sql); ?> <h3>UPDATE / DELETE ORDERS</h3> <table border=1"> <tr> <th>CUSTOMER NAME </th> <th>PAY DATE</th> <th>AMOUNT</th> <th>STATUS</th> <th>UPDATE</th> <th>DELETE</th> </tr> <tr> <td> </td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <?php while ($myrow = mysqli_fetch_array($data)) { echo "<TR> <TD>".$myrow["customer_name"]."</TD> <TD>".$myrow["paydate"]."</TD> <TD>".$myrow["money"]."</TD> <TD>".$myrow["status"]."</TD>"; echo "<TD> <a href=\"update-edit-order.php?id=".$myrow['id']."\">UPDATE</a> </TD>"; echo "<TD> <a href=\"delete-order.php?id=".$myrow['id']."\">DELETE</a> </TD>"; echo "</TR>"; } ?> <tr> <td> </td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> </table> <br /> <?php $sql = "SELECT * FROM orders where orderby='Mark'"; $data = $con->query($sql); $records = $data->num_rows; $records_pages = $records/4; $records_pages = ceil($records_pages); $prev = $page-1; $next = $page+1; echo '<ul class="paganation">'; if($prev >= 5){ echo '<li><a href="?page=1">First Page</a></li>'; } if($prev >=1){ echo '<li><a href="?page='.$prev.'">Previous</a></li>'; } if($records_pages >= 2 ){ for($r=1; $r <= $records_pages; $r++){ $active = $r == $page ? 'class="active"' : ''; echo '<li><a href="?page='.$r.'" '.$active.'>'.$r.'</a></li>'; } } if($next <= $records_pages && $records_pages >= 2){ echo '<li><a href="?page='.$next.'">Next</a></li>'; } if($page != $records_pages && $records_pages >= 5){ echo '<li><a href="?page='.$records_pages.'">Last Page</a></li>'; } echo '</ul>'; ?> <?php } ?> </div> <?php include('styles/bottom.php'); ?>
-
-
Hey Guys I'm having problems inserting customer name in to my database it isn't showing any errors on my site just the site looks all messed but like there is something wrong. there is other fields but im not using them at the moment? <?php include('styles/top.php'); ?> <div id="left"> <?php if ($user_level !=1){ } else { $sql = "SELECT SUM(status='Pending')as pending , SUM(status='Layon') as layon , SUM(status='Late') as late , SUM(status='Paid')as paid FROM orders"; $result = mysqli_query($con, $sql); $row = mysqli_fetch_assoc($result); echo " <form action='pending.php'> <input type=\"submit\" class=\"button\" value=\"Pending Payments ( {$row['pending']} )\"> </form> <form action='total-layons.php'> <input type=\"submit\" class=\"button\" value=\"Total Layons ( {$row['layon']} )\"> </form> <form action='total-late.php'> <input type=\"submit\" class=\"button\" value=\"Total Late Payments ( {$row['late']} )\"> </form> <form action='total-paid.php'> <input type=\"submit\" class=\"button\" value=\"Total Paid Payments ( {$row['paid']} )\"> </form> <form action='add-customer.php'> <input type=\"submit\" class=\"button2\" value=\"Add Customer\"> </form> "; ?> <?php } ?> </div> <div id="right"> <div id="view_box"> <ul> <li><img src="images/1.png" /></li> <!-- <li><img src="pics/2.jpg" /></li> --> <!-- <li><img src="pics/3.jpg" /></li> --> </ul> </div> <div id="button"> <ul> <!-- <li><button class="button" scroll_value="0">*</button></li> -- > <!-- <li><button class="button" scroll_value="600">*</button></li> --> <!-- <li><button class="button" scroll_value="1200">*</button></li> --> </ul> </div> <hr /> <?php if ($user_level !=1){ echo "No Access Allowed Admin Only "; } else { ?> <?php $form = " <form action='add-customer.php' method='post'> <table cellspacing='10' cellpadding='10'> <tr> <td>Customer Name</td> <td><input type='text' name='customer_name' /></td> </tr> <tr> <td></td> <td><input type='submit' name='submit' class='button' value='Add New Order To The system'/></td> </tr> </table> </form>"; if (isset($_POST['submit'])) { $name = $_POST['customer_name']; if ($name) { incude (''); $query = "INSERT INTO customers (customer_name) VALUES ('$name')"; $result = mysqli_query($con, $query); echo "<font color='Yellow'>Thank you, Information has been saved to the database <a href='index.php'>Click Here</a> To Return to Previous Page!.</font> <br>"; } else echo "Please enter customers name. <br> $form"; } else echo $form; ?> <?php } ?> </div> <?php include('styles/bottom.php'); ?>
-
Sorry it did. i need to do it like this show it shows different ones for Pending , Paid $sql = "SELECT * from orders WHERE status='Pending'"; $sql2 = "SELECT * from orders WHERE status='Paid'"; if ($result = mysqli_query($con, $sql)){ $rowcount = mysqli_num_rows($result); echo "<input type='button' class='button' value='Pending Payments ($rowcount)'>"; } if ($result2 = mysqli_query($con, $sql2)){ $rowcount2 = mysqli_num_rows($result2); echo "<input type='button' class='button' value='Pending Payments ($rowcount2)'>"; }
-
Markob1984 joined the community
-
hello I'm using the below code to count the rows then display them but its showing $rowcount instead of the value from the database <?php if ($user_level !=1){ } else { $sql = "SELECT * from orders WHERE status='Pending'"; if ($result = mysqli_query($con, $sql)){ $rowcount = mysqli_num_rows($result); echo '<input type="button" class="button" value="$rowcount">'; } ?>