I have no idea if it is possible to post selling product if there's no human operation. What I mean is this scenario.

this is a bookstore that wants to create an online page of shopping cart for their own.

Among the thousands of items in that bookstore that is available.

a person has determined during the inventory hours to which is the top 5 selling products of their bookstore.

Problem: Is there a way that only a machine could determine dynamically implemented to which among the thousands of items in that bookstore is the TOP 5 selling products, with out the human acknowledgement?

I need your opinions guys. If there is a tutorial or a code please tell me.

This is for my thesis purposes. Web Ordering System is the Genre of my thesis.

Recommended Answers

All 5 Replies

If every book and sale is kept in the database, then determining the best seller is relatively easy. The actual query depends on the structure of your database and your specific requirements.

If every book and sale is kept in the database, then determining the best seller is relatively easy. The actual query depends on the structure of your database and your specific requirements.

You said there it is "relatively easy". my Database has all items on one table, transaction per customer on the other table. Inventory Reports table is the last table I created. But to determine the best selling thru inventory reports which is Top 5.... I don't know. I'm not good on array elements comparison. I believe that start process of this kind program was the mysql_fetch_array.

I think you are trying on the wrong side. Do not try to solve this with PHP, but let a query do the work for you. Although you _can_ do it in PHP, doesn't mean it is the best, or the only, way. SQL is made for this stuff, so use it.

I think you are trying on the wrong side. Do not try to solve this with PHP, but let a query do the work for you. Although you _can_ do it in PHP, doesn't mean it is the best, or the only, way. SQL is made for this stuff, so use it.

Yeah you're right but My Client ( the boss of the bookstore ) wants only PHP for 0 cost of web hosting. I don't know If I can cross connect MSSQL with PHP.

I'm trying to solve now using mysql_query... "Select * From `books_table_inventory_reports` ORDER BY `inventory_number`" is my query but the problem is.... I cannot get the top of it because of this case:
case 1:
book a has $200 <--the top selling book by number inventory report
book b has $300 and book c has $150 <-- has the same number of inventory report (this is the problem wherein I want both of these books to be enlisted since their inventory ranking is at the top 5)
case 2:
among the thousands of items in order by the number of inventory report number. How would I only get the top 5?

You can use LIMIT to select only 5 records. As for books with the same number sold, you'd have to determine a second order by column (e.g. total revenue, or book price), so you get the order you want.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.