|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
how do they do it(dates)
I noticed this in many websites and I always wondered how they did it
take any website where I have done some things in the past and I need a history like paypal or whatever they always have something like this: [date(ex:1/1/2001)] and [action(ex: you bought a tootpick)] how do they store all those dates for a single customer? |
|
#2
|
|||
|
|||
|
RE: how do they do it(dates)
Purchases for each customer are stored in a database along with the date purchased. When that customer is visiting the site, search through the database using his customer id and display the date and name of items he has purchased.
|
|
#3
|
||||
|
||||
|
RE: how do they do it(dates)
Yeh they will store some kind of transaction log, similar to a bank statement. Most likely using a timestamp to store the date/time and then formating it with a function similar to the php date() function.
|
|
#4
|
|||
|
|||
|
Message Moved
Thread moved from 'PHP Coding' to 'Programming Theory' by Andrew.
Reason: |
|
#5
|
|||
|
|||
|
RE: how do they do it(dates)
I still don't understand how this could be done with a database
Let's say I have an ecommerce site and my users can buy and sell items. When an user wants to buy something he finds another user that has that and makes him an offer. This user sees the offer and can accept reject or modify it. This is a real world scenario. Now, when a user logs in he has to be able to view his transactions' history so how could this be saved in a database so as to enable the user to see his transaction history like this: and so on 1-4-2002 user B accepted your offer 1-3-2002 You modified user B's offer 1-2-2002 user B modified your offer 1-1-2002 You sent an offer to user B of course I would have a table with the transaction info such as item cost shipping but how would a table look like that could store all those dates from the transaction history? How could one design such a database? Which would be the proper database design? |
|
#6
|
|||
|
|||
|
RE: how do they do it(dates)
I just made this db and this is how I would do it.
Code:
-- phpMyAdmin SQL Dump -- version 2.9.1.1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Dec 27, 2006 at 03:11 PM -- Server version: 5.0.24 -- PHP Version: 5.2.0 -- -- Database: `test1` -- -- -------------------------------------------------------- -- -- Table structure for table `item_listings` -- CREATE TABLE `item_listings` ( `listingID` int(10) unsigned NOT NULL, `userID` int(10) unsigned NOT NULL, `title` varchar(255) NOT NULL, `description` text NOT NULL, PRIMARY KEY (`listingID`) ) ENGINE=InnoDB ; -- -- Dumping data for table `item_listings` -- |
|
#7
|
||||
|
||||
|
RE: how do they do it(dates)
<completely off the top of my head>
maybe make an offer table and a transaction table... offer table links to the 2 customers with any details you may have including a key to link multiple offers on one transaction. transaction could then just have the finalized deals with a link into the offers table to see what happened. </off the top of my head> |
|
#8
|
|||
|
|||
|
RE: how do they do it(dates)
oops, I did have 2 tables there when I made it, guess it never exported it when I tried to export them both. this is the whole thing I had:
Code:
-- phpMyAdmin SQL Dump -- version 2.9.1.1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Dec 28, 2006 at 11:45 PM -- Server version: 5.0.24 -- PHP Version: 5.2.0 -- -- Database: `test1` -- -- -------------------------------------------------------- -- -- Table structure for table `item_listings` -- CREATE TABLE `item_listings` ( `listingID` int(10) unsigned NOT NULL, `userID` int(10) unsigned NOT NULL, `title` varchar(255) NOT NULL, `description` text NOT NULL, PRIMARY KEY (`listingID`) ) ENGINE=InnoDB ; -- -- Dumping data for table `item_listings` -- -- -------------------------------------------------------- -- -- Table structure for table `transactions` -- CREATE TABLE `transactions` ( `transID` int(10) unsigned NOT NULL, `listingID` int(10) unsigned NOT NULL, `userID` int(10) unsigned NOT NULL, `datetimeOffered` datetime NOT NULL, `datetimeExpires` datetime NOT NULL, `comment` varchar(255) NOT NULL, `offerAmount` decimal(5,2) NOT NULL, PRIMARY KEY (`transID`) ) ENGINE=InnoDB ; -- -- Dumping data for table `transactions` -- |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Programming Theory > how do they do it(dates) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|