Date: 11/30/00
- Next message: David Vázquez: "[PHP-DB] sql server stored procedures output parameter"
- Previous message: Bob Hall: "Re[2]: [PHP-DB] Re: MySql or postgre?"
- In reply to: Uioreanu Calin: "[PHP-DB] PHP-mysql better way to build a pyramid table"
- Next in thread: Nold, Mark: "RE: [PHP-DB] PHP-mysql better way to build a pyramid table"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This is more commonly done in a single table instead of two tables.
Doug
At 03:45 PM 11/30/00 +0200, Uioreanu Calin wrote:
>Hello,
>
> I want to create through a few number of tables with fewest records
>a pyramid structure like this: a new person cames into the person's
>table reffered by another one. There are fields for direct reffered persons
>and total refferals from each existing person in person's table. So each
>new person increases his (parent's) direct reffered persons and each
>of his parent's parent's and grandparents and ... total refferals.
>
> I builded these tables:
>CREATE TABLE tbl_mlm_users (
> username varchar(50) NOT NULL,
> userpass varchar(50) NOT NULL,
> personal_refferals int(11) DEFAULT '0' NOT NULL,
> total_refferals int(11) DEFAULT '0' NOT NULL,
> iduser int(11) NOT NULL auto_increment,
> userfullname varchar(50) NOT NULL,
> useradress varchar(50) NOT NULL,
> useremail varchar(50) NOT NULL,
> PRIMARY KEY (iduser)
>);
>&
>CREATE TABLE tbl_mlm_refferals (
> iduser_parent int(11) DEFAULT '0' NOT NULL,
> iduser_child int(11) DEFAULT '0' NOT NULL,
> ref_time varchar(20) NOT NULL,
> PRIMARY KEY (iduser_parent, iduser_child)
>);
>
>
> where id.. points to the other table for details.
>ref_time is the time when the reffer occurs.
>
> Is there a better way of doing that?
>
>--
>Regards,
>------------------------------------------------------
>Calin Uioreanu
>udmsromkt <email protected>
>DMS Team Cluj-Napoca Romania
>-----------------------------------------------------
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: David Vázquez: "[PHP-DB] sql server stored procedures output parameter"
- Previous message: Bob Hall: "Re[2]: [PHP-DB] Re: MySql or postgre?"
- In reply to: Uioreanu Calin: "[PHP-DB] PHP-mysql better way to build a pyramid table"
- Next in thread: Nold, Mark: "RE: [PHP-DB] PHP-mysql better way to build a pyramid table"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

