Display category results - php &amp; mySQL
This project was awarded to nirandas for $136 USD.Get free quotes for a project like this
Project Budget$100 - $500 USD
This php web page will display a list of links for a selected category.? Depending on the number of records returned, you may have to page the results.? You will also need to display a dropdown list of categories that enables the user to select a different category.? You will also need to record which records were displayed, and in which position.
This? is a php and mySQL application.?
This php web page will display a list of links for a selected category.? Depending on the number of records returned, you may have to page the results.? You will also need to display a dropdown list of categories that enables the user to select a different category.
The php page will be called via the following URL:
<[url removed, login to view]>
where [[url removed, login to view]] is a site I host and I’ll upload the [url removed, login to view] file that you’ll write.
If any of the 4 values in the URL are missing/blank or if the link is improperly formatted, return an error message.? Otherwise continue.
If SID=1, set Num to 2, if SID=2, set Num to 3, else set Num to 4 (Num is the number of records to display in the list)
Then query the List table (see definition below) and get all records where CID (Category ID) equals the CID in the URL above, and where Active equals true.? Sort the results by Rank, and store the Position of each record in the resulting array.? For example, if 8 Active records are retrieved, associate Position 1 with the first record in the array, Position 2 with the second record, etc.? Also count the total number of records retrieved, and determine how many pages of results you have, based on dividing the record count by Num.
Then, for records retrieved from the query, display up to Num records, starting at StartNum.? Specifically, for each record, display its Name, and hyperlink each Name using a URL formatted as follows: [url removed, login to view]? StartNum is the pointer, or offset, that tells you which record in the list to start with when displaying a page.? For example, if StartNum is 1, and Num is 3, and the count of records returned is 10, you will display 3 records (because Num=3) starting with the first record (because StartNum=1), and you will not display the remaining 7.? If StartNum is 4 (and still assuming Num=3 and count=10), you would start with the 4th record and display 3 records.? If StartNum=10, you would only display one record (i.e., record #10) because there are only 10 records.
As you display each record, create a new record in a mySQL table to record which records were displayed.? That is, record the date/time, PID, SID, CID, AID and the Position.
Next, show paging if required.? That is, if Num is less than count, there are more records to display, so you need to paginate.? Show page numbers (1 2 3 or however many there are ??" we probably won’t exceed 10) along with Prev and Next.? Do not show a page number or the Prev and Next links if there is just one page of results.? Do not link the current page number, but link all other page numbers.? Only link Prev and Next to its corresponding page if that page is currently not being display.? For example, if you’re displaying page 1, do not link Prev, just show Prev in grey. ? ? Note that each page link is the same as the URL that originally called the php page, with the only change being StartNum.? StartNum is simply the starting record number for that page.? For example, if Num=3 and count=10, there would be 4 pages, and StartNum for page 1 is 1, StartNum for page 2 is 4, StartNum for page 3 is 7, and StartNum for page 4 is 10.
Finally, show a dropdown list of all categories.? Selecting a new category simply redisplays this same php page with a list for that category.? To generate the dropdown list of categories, query the List table for all Active records, and then generate a list of all unique CIDs.? Then query the Category table (see definition below) to get the CatName and Order for each category.? Display the resulting CatNames in a select dropdown, sorted by Order.? Each select option in the dropdown should be linked to the same URL that calls this page, where CID is the CID of the specific category option, PID and SID are from the original URL, and StartNum=1 (that is, when a new category is selected, we want to display from the top of the list for that category).? Execute upon selecting of a new category (i.e., do not require the user to click a submit button).
-? ? ? ? ? ? ? ? CID (char)
-? ? ? ? ? ? ? ? AID (char)
-? ? ? ? ? ? ? ? URL (char)
-? ? ? ? ? ? ? ? Name (char)
-? ? ? ? ? ? ? ? Active (true/false field)
-? ? ? ? ? ? ? ? Rank (numeric field)
-? ? ? ? ? ? ? ? CID
-? ? ? ? ? ? ? ? CatName
-? ? ? ? ? ? ? ? Order
Looking to make some money?
- Set your budget and the timeframe
- Outline your proposal
- Get paid for your work
Hire Freelancers who also bid on this project
Looking for work?
Work on projects like this and make money from home!Sign Up Now
- The New York Times
- Wall Street Journal
- Times Online