I want contacts to have a 1-1 relation to px_items. I'm hesitant to add the
contact info onto px_items because <http://www.feedonfeeds.com/> uses that
table.
from phpMyAdmin, how would I re-organize things pls? Or, must I manually enter
the SQL to establish the foreign key part?
Once I have things setup, I'll want to make a query to insert data to the
contacts table through PHP. Generally, what would such a query look like?
"CREATE TABLE ORDERS
(Order_ID integer,
Order_Date date,
Customer_SID integer,
Amount double,
Primary Key (Order_ID),
Foreign Key (Customer_SID) references CUSTOMER(SID)); "
<http://www.1keydata.com/sql/sql-foreign-key.html>
mysql>
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| apts |
| feeds |
| mysql |
| test |
+--------------------+
5 rows in set (0.00 sec)
mysql> use feeds;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+-----------------+
| Tables_in_feeds |
+-----------------+
| contacts |
| px_feeds |
| px_items |
+-----------------+
3 rows in set (0.00 sec)
mysql>
mysql> describe px_items;
+-----------+--------------+------+-----+-------------------
+----------------+
| Field | Type | Null | Key | Default |
Extra |
+-----------+--------------+------+-----+-------------------
+----------------+
| id | int(11) | NO | PRI | NULL |
auto_increment |
| feed_id | int(11) | NO | MUL | 0
| |
| timestamp | timestamp | NO | | CURRENT_TIMESTAMP
| |
| link | text | YES | | NULL
| |
| title | varchar(250) | YES | | NULL
| |
| content | text | YES | | NULL
| |
| dcdate | text | YES | | NULL
| |
| dccreator | text | YES | | NULL
| |
| dcsubject | text | YES | | NULL
| |
| read | tinyint(4) | YES | MUL | NULL
| |
+-----------+--------------+------+-----+-------------------
+----------------+
10 rows in set (0.00 sec)
mysql> describe contacts;
+--------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| html | longtext | YES | | NULL | |
| e_mail | varchar(50) | YES | | NULL | |
+--------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> quit
Bye
[thufir@localhost ~]$ date
Sat Apr 21 20:03:37 BST 2007
[thufir@localhost ~]$
[thufir@localhost ~]$
thanks,
Thuifr
| Thread |
|---|
| • one-to-one relation, foreign key creation | Thufir | 21 Apr |