Welcome back.
Now, what we need to do is that we need to get orders.
So as soon as a user places an order, we need to display the order here.
And if the order has been filled, we also need to display a history of all orders that the user has
made so we can display the order and the date, and we can also display the the status of the order,
whether the order was delivered or paid or not paid.
All of these things must be displayed in the user account.
So let's work on this area.
So this area exists in the remember in the order in the account that we be in the order in the orders
under this order section.
So under this order section we have, we don't have a form or anything because there will be no form.
There will be in a set, there will be a script.
I'm going to create a script that's going to get all of the orders.
So to do this here in this account at the beginning here, let me close this so that our code becomes
a little shorter here.
So we have all of this code.
Let me close all of these and here I'm going to add a comment and then I'm going to say get orders.
So to get the orders first we need to say F and then we need to get all of the orders and to get all
of the orders, we need to make sure that the user is logged in.
So I'm going to say a session.
Is set.
If a user is logged in.
Then what we need to do.
Logged in.
What we need to do is that we need to get all of the orders and to get all of the orders.
We can use the code that we already have, which if you open the server and then get get order or get
codes, for example, you can copy this code and then paste it here inside this statement.
But we need to import the server so we are the importer, the connection server connection.
So here, instead of saying, instead of saying prepare, select all from products, we need to say
select all, select all from orders orders we're user ID, user underscore ID.
Let me show you that in the database.
In the order we can get the order by bye bye up by knowing the user ID.
So we need to know the user ID so that we get only orders that belong to that specific user.
So here I'm going to say where user ID is equal to.
And then question mark.
That's it.
And then what I'm going to do is that I'm going to say is the empty bind.
Bind param.
Then we need to bind the user ID.
So to get the user ID, we need to use a session.
User underscore ID session.
Session.
User 80.
User the score 80.
And here we need to pass the user I.D., user I.D. and here execute and then get our results and then
get here.
I'm going to say orders.
This is going to be order.
So orders are going to be equal to a statement, get result, very, very simple.
And then we need to loop over all all of the orders.
So the orders will contain the order ID the order cost the order status, which is very important.
The user for number, the city, the user address, these these things are not important.
These things are for us because we as the the owner of the website, we need to order their business,
the owners of the business business.
We need to know the user address of the user city and the user phone number in order to contact the
user.
But for the user, we just need to display reference to the user such as the order ID, the order cost
and the status and the and and the date as well.
So let's display these things.
I'm going to display the order ID cost status and date.
So here remember we have.
We have here order.
We have product date.
We only have the product and date and they don't want that.
Instead I'm going to say order item and I'm going to create another column and that is going to be for
the order cost.
Cost.
And then.
The hatch, the edge.
And then what else?
Order.
Order course or order status, which is very important.
Order status.
And then date ordered it.
And we need to hear to get a look.
So here I'm going to take it.
Instead of displaying this static code, I'm going to remove this card or coming this card out.
And instead I'm going to create a loop here.
I'm going to say BHP.
And here I'm going to say while.
While then clearly bracket only up in the early bracket and then orders.
And then.
Fetch.
Fetch a sauce.
And then I'm going to say here, raw is equal to orders.
Fetch a sauce and then in between, I'm going to display this.
I'm going to now uncomment this.
Lamy, uncomment this.
And I'm going to push it as well.
Let me push it.
And by law, we need to close the.
Here was the Hurley bracket here.
I'm going to say HP and then I'm going to close the Haley bucket.
And in between I'm going to here say instead of the image, I'm going to we don't need this image.
I'm going to call this image out.
And instead of going to display the order here, I'm going to display the order.
I'm going to say order ID, which is going to be beach P.
BHP.
Ra echo ra.
Order, I.
Order underscore 80.
So this is for the city.
The for the city.
And then we want.
We want to go yet another to here, Dee Dee.
And then this CD is going to be for the.
Uh, order it for the Oracle.
So this CD is going to be for the order?
Of course I'm going to say Span.
And then BHP.
And then echo.
And then raw.
Order cost.
I mean, the status of it already.
So I'm going to copy this and then I'm going to pay.
It'll be law and then I'm going to say Order status.
And finally order date instead of this.
I'm going to say order date.
Laney save and let's say then over to the browser to test.
So now let me refresh here and I should get all of the I should get all of the orders.
And as you can see, I will not get any orders.
And as you can see, I will not get any orders because I didn't make any orders.
But let me change intentionally change my user I.D..
Two one because I need you to number one has made all of these IDs and I have a user I.D. of one of
eight.
So I'm going to say one, I'm going to change my ID here like this.
Of course, you should be doing this in a real system because otherwise you will ruin your system.
And by the way, I need to log out because, uh, the ID, the ID restored in this session.
So I'm going to log out and then I'm going to log in one more time.
I'm going to log in and.
Now.
I should get all of the orders.
As you can see, I'm going to get all of these orders.
I'm going to guess the order number.
Six, seven, eight, five, six, seven, eight.
And they belong to me.
The reason why I got these, because they belong to me.
And they'll let me fix the table a little.
To fix the table, we just need to remove this glass.
Let me remove this glass.
And let me refresh.
And it didn't fix it because I think we don't need all of this.
We actually don't need all of this.
I'm going to comment this out or delete this completely.
And instead I'm going to be using a spam just like like the other.
Like the other.
Across.
So here I'm going to use a Spanish that I'm going to say here Spanish.
And then I'm going to say Order I.D. and here, order it.
So it should work now.
So it's now better.
Now it's better.
And we just need to, uh.
Uh, let me head on over to the order.
So, MVC, MVC case, let me quickly fix this.
So in the style and the orders.
We have here.
The orders are the action.
The child is on the right side.
So we need to comment this out.
And we need to.
I think this is perfect.
So this is perfectly me.
Try to refresh and test.
So this should fix it.
As you can see, it has been fixed.
The order date, I think the order date.
Is here the order.
Here takes a line left.
We need to comment this out.
Just comment this out, and they should fix it.
So as you can see, it has been fixed.
So now we have all the orders and all of it is on the right side.
And lastly, I'm going to display a button to take the user to a new page to display information about
each order.
Therefore, in the.
In the.
Uh, in the account here, what I'm going to do is that I'm going to add a new to each year.
I'm going to say the edge.
And then I'm going to say.
Order and full order details.
And then I'm going to hear.
Creative TV, I'm going to say TV.
And then here we just need to create a.
A for leaving the forum then obviously input.
And then I'm going to say a class.
Button.
B The end button and types of mat.
And value is details.
Let me refresh and we should have your order detail so we can see all the details and it's clickable
so you can add the order details and let's use the the order.
One of the classes that we had.
So we can see at the end.
And then I have, I think you.
We have the class, this class, but they don't want to use any other class that couldn't do in our
design.
So we can't do it quickly.
In these cases, we can create a class.
Here in the orders.
I've been asking about orders.
Orders.
And in the orders this.
Uh, this order.
So in this order, what I'm going to do is that I'm going to say, uh, details.
That order.
Details.
But in the colour.
Is it going to be white?
And the background color.
Is it going to be orange?
So now it should now display an awesome button.
Uh, by the way, I forgot to add here the button.
I'm going to say.
Order, order.
Details about it.
Details.
Button.
Order, hyphen.
Details.
Hyphen, body.
Let me now refresh one more time.
And as you can see, we will have these parents.