Welcome back.
So now what I'm going to do is that I'm going to work on the side menu.
So let me log in first and show you this side.
So in the side menu, we have all of these things and we need to display the dashboard.
And the main thing that I'm going to be displaying in the dashboard is the orders.
I'm going to be displaying the orders of the products, and then I can do these things.
So the side menu here, we have side menu.
I'm going to first display the dashboard and then I'm going to give it a trip.
The trip is just going to be index that HP and the orders as well is going to be the orders is going
to be in the index index.
That is because the orders will be displayed in the index and then we have the products.
I'm going to say here products.
Dot BHP.
And then here I don't need this customers.
I'm going to this and I need a to display just beneath the email of the admin.
And then we need also to display Laney here instead of displaying customers.
I'm going to say add you.
Right.
So I'm going to add I'm going to add this add new product below the account.
So first account and then add new product and then let's add it up.
We need to get the orders.
So at the top of this.
Actually here, we need to say before I go to this lady here at the links, I'm going to say here,
add, add, underscore you underscore project that HP.
And I'm going to say account.
That.
And that's it.
Now, let me go to the index and let's work on the orders.
The good news about the orders is that we already know how to get the orders.
Remember, if you go back to the to your to the account, you remember in the account, which is this,
you will find that we already have a code that gets us three orders.
I think it's here.
It's here.
Get orders so we can't copy this code.
I'm going to copy this code.
I'm going to copy this.
Good.
And then I'm going to base it here in the index.
However, we don't need to use year if statement.
We just need to get the orders as soon as the user, as soon as admin enters this page.
So I'm going to I'm going to remove this statement and then I'm going to say.
Um.
I'm not going to say user I.D..
Instead, I'm just going to say statement, connection, repair, select all from orders where we orders
waiters know where here I'm going to remove it and we just need to remove that as well.
So because we're just going to be three lines.
However, the problem with this is that.
We have two problems, actually.
The first problem is that in the heather we need to include the connection to the database.
Heather.
We need to make sure that we are connected to the database.
So here in the heather, we need to say.
We need to say each big event included, and then we need to go back.
And then we need to say a server or slash connection.
Not HBO.
So this is the first problem, and I just solved this problem.
The second problem is that we need to add pagination.
Because here, imagine that you have so many orders.
It's not going to work.
It's going to be a problem.
Unfortunately, we already have the pagination in the shop page, so I'm going to get the pagination
quote from the shop page.
So here in this shop page at the top.
Remember at the top, we have this, we have this.
We just need this code.
I'm going to copy this.
Good.
We just need this.
Good.
And then what I'm going to do is that I'm going to paste it in the.
In the index that BHP.
Here in this instead of saying instead of using all of this code, this code is fine.
But the problem with it is that if you have so many orders, it is going to be a problem.
So we need to remove this code and then we need to use the pagination.
So here we need to fix of course, we need to fix many things.
First of all, I'm going to push the code because.
Because now I cannot read it perfectly.
Let me now read the quotes from the beginning.
So here the first thing that we need to do is that we need to use page number.
Everything's fine here.
However, we need to say select count all as total records from orders from orders and then execute
and then total records.
And then total records is equal.
You can say eight, nine, ten, whatever you want.
Let's say ten your offset and then page number.
Everything's fine here.
Then we need to say here, select, prepare, select all from products limit, offset records page.
Here we should say select all from orders.
And we should remove this clearly bracket.
And at the bottom, we need to add the pagination.
So at the bottom, I'm going to give it pagination from the shop.
From the shop.
Here we have this pagination code.
We have this.
We have this navigation bar.
Let me copy it and let me put it in the index here.
We need to paste it here.
We need.
Let me first make sure that I'm going to base it in the right place.
So this Dave belongs.
Too.
I think this they've they make they have and this is this case.
Yes, there are.
So we need to I think we need to get inside the rock.
So we need to add because inside this step.
So here it should.
I think it should be here.
Let me test me out here.
I'm going to say here, B, and then I'm going to say test.
So it should be displayed below the table.
Now it's being displayed here.
So we need to add everything inside below the table.
So it should be here, I should say here for the event test.
So it's below the table.
So here I'm going to place the code.
Here.
I'm going to stick with Leni here.
Remove this test and let me give myself a big space.
I'm going to give myself a big space so that you see.
And then I'm going to basically because he's going to be here.
Let me save a lady here, then over to the browser and refresh.
And as you can see, we have this pagination.
Now we need to loop over the orders.
So in order to loop over the orders, we have to remove all of these records from the table and leave
only one.
So let's start removing from the top.
So from the top.
From the top.
We have we have here ID, we have we have an area and then we need the order ID, the order status,
order status.
And then we need the order date.
We need the order, order, status, order date.
Order date.
And read the user.
Let's display first the user.
I'm going to say user or customer I.D., user ID, user ID.
And first, the order I.D. and then the order status and then the order.
I think.
And then we need to say here edit.
And then we need to say also delete.
But we also need the order.
We also need the actually read, also the user phone number.
I'm going to say use our foreign.
He was a reform.
And we can display the user city, for example, or user address.
User Outers, user address.
So that is.
That's it.
Me letting me remove these figures from the table and I'm going to leave only once.
So I'm going to leave this and then I'm going to remove this and this.
All of these.
I'm going to remove all of these.
You need to be very careful while already moving.
So let me keep only one.
Now we have only one lady saved.
And let me make sure that we don't have problems.
Let me refresh.
And as you can see, we have only one drawer and let's work on this.
So here I'm going to add each because I'm going to keep up and then I'm going to say for each.
And then for each.
What?
For each?
We have the orders.
I think here we should say orders.
Orders.
So for each orders as order, I'm going to say.
Order as.
Orders are orders as order.
Orders as order.
And then at the bottom.
We need to say BHP and then close this yearly bracket and in between we need to display first we order
80 BHP and then order.
Order I.D..
And don't forget to say Echo.
Don't forget to say Echo.
And then instead of doing this many times, I'm going to copy it.
So I'm going to copy this.
And then the second the second draw was for the starter.
So I'm going to say here, order.
And then the third is going to be for the user it.
User I.D. and then the order the order date and then the user form, user form.
And next we have the user form and user address and edit and delete.
So I use a phone and then address user.
Address.
And then your user address and then edit.
So of course edit and delete.
We shouldn't be displaying BGP, we should display buttons.
So I'm going to hear about an attack and then I'm going to say edit.
And then I'm going to say.
Edit I'm going to say it.
Class button.
Beatty and Primary.
And therefore the delete.
I'm going to also create a delete button and I say a attack and then class button.
Beaton.
And meaty end.
Meaty end.
Between danger.
And then I'm going to say delete.
Let me save a linear refresh now.
It's going to look amazing, as you can see.
Now, I'm going to get all orders.
So these are all of the orders that they have.
And I'm going to get only as you can see, I'm going to get one, two, three, four, five, six,
seven, eight, nine, ten.
If I click on two, I'm going to get the rest.
But since I only have ten, I think I have only ten.
I'm going to get one, two, three, four, five, six, seven, eight, nine, ten.
So this is the the the problem.
ZELENY Decrease artists just to make sure that everything is working.
Let me hear say five.
Order five records per page.
If I say five figures for page, I'm going to get only five here.
And if I click on two, I'm going to get another five.
So every pagination now works perfectly.
And lastly, we need to say orders.
So instead of saying.
Instead of saying your section title, I'm going to say orders.
And we are good to go.