Jump to content

SQL query in php file - list of products and quantities ordered in the recent placed orders


nick_escu
 Share

Recommended Posts

Hi,

If anyone could help me with a php script/file for the following sql query, I would be very grateful:

SELECT product_name, SUM(product_quantity) FROM ps_order_detail
WHERE (id_order>XXX AND id_orderTTT AND id_order<>VVV AND id_order<>.......)
GROUP BY product_name

where XXX, YYY, TTT, VVV,.... are user's input (in a form maybe). Orders will be considered from XXX to YYY excepting TTT, and VVV and ....
TTT and VVV and... are canceled orders (or orders I do not want to consider for some reason).

I don't know php (I'm trying to learn now) and I've seen that there are some issues with security (something with sql injection).
I'm using the query above in phpmyadmin for now and it's ok, but I'm trying to improve and learn.

Thank you,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More