giftweb-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Giftweb-discuss] CVS updated


From: Matthew T. Jachimstal
Subject: Re: [Giftweb-discuss] CVS updated
Date: Mon, 01 Mar 2004 20:55:37 -0600

On Sun, 2004-02-29 at 21:41, Gregory Gee wrote:
Couple of quick questions:

> ALTER TABLE items ADD COLUMN store text;

How's this different from the URL/Store field?

> ALTER TABLE items ADD COLUMN cost text;

How's this different from Paul's price field?

> CREATE TABLE item_grp (grp_id smallint DEFAULT nextval('items_gid_seq'::text) 
> ALTER TABLE ONLY item_grp ADD CONSTRAINT items_gid_uid_unique UNIQUE (grp_id, 
> uid);

Why unique on grp_id and uid both?


> ********************************************************************
> $conn = ADONewConnection($dbtype);
> $conn->PConnect($dbhost, $dbuser, $dbpass, $dbname);
> 
> $sql = "SELECT uid FROM users";
> $result = $conn->Execute($sql);
> 
> for ($i=0; $i < $result->RecordCount(); $i++) {

This I get; Add the "Gifts" group for all users.

>      $uid = $result->fields["uid"];
>      $sql2 = "INSERT INTO item_grp (uid, name) VALUES ('$uid', 'Gifts')";
>      $result2 = $conn->Execute($sql2);
> 

What do these two do?

>      $sql3 = "SELECT grp_id FROM item_grp WHERE uid='$uid'";
>      $result3 = $conn->Execute($sql3);
>      $gid = $result3->fields["grp_id"];
> 
>      $sql4 = "UPDATE items SET grp_id='$gid' WHERE uid='$uid'";
>      $result4 = $conn->Execute($sql4);
>      $result->MoveNext();
> }

Matthew

--
Random thought #50 (Collect all 137)
The chief enemy of creativity is "good" sense -- Picasso 

| Matthew T. Jachimstal KG9LF
| email: address@hidden
| www: http://www.jachimstal.com
| <*> [\]

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]