[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Giftweb-discuss] CVS updated
From: |
Gregory Gee |
Subject: |
Re: [Giftweb-discuss] CVS updated |
Date: |
Tue, 02 Mar 2004 10:18:32 -0500 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 |
Matthew T. Jachimstal wrote:
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?
This is a new column. I wanted to split the URL and store.
ALTER TABLE items ADD COLUMN cost text;
How's this different from Paul's price field?
Similar but Paul's was too restrictive. I wanted something a little more
flexable to support multiple currency and also enter something like
'up to $10' in that 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?
Cut and paste error. Only grp_id needs to be unique. I copied this line
from some other entry. I think it was the group table.
********************************************************************
$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?
This finds the new grp_id that was created and sets all existing items
for that user in the database to the new default group called 'Gifts'. All
items must belong to a group.
$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
| <*> [\]
------------------------------------------------------------------------
_______________________________________________
Giftweb-discuss mailing list
address@hidden
http://mail.nongnu.org/mailman/listinfo/giftweb-discuss