dsartain Posted September 16, 2006 Share Posted September 16, 2006 I have MySQL two tables set up like this:[code]CREATE TABLE `speakers`(`speaker_id` INT(9) NOT NULL auto_increment,`speaker` VARCHAR(30) NOT NULL,PRIMARY KEY (speaker_id);)CREATE TABLE `RSS_info`(`cast_id` INT(9) NOT NULL auto_increment,`speaker_id` INT(9) NOT NULL,`title` VARCHAR(50) NOT NULL,`filename` VARCHAR(20) NOT NULL,`description` VARCHAR(200) NOT NULL,`pubDate` VARCHAR(32) NOT NULL,`size` INT(20) NOT NULL,PRIMARY KEY (cast_id),FOREIGN KEY (speaker_id) REFERENCES `speakers` (speaker_id) on delete cascade); TYPE=MYISAM[/code]I know how to insert data into one table...[code]<?php$var1=$_POST['value_name'];$dbconn=mysql_connect("localhost", "username", "password");$db=mysql_select_db("db_name");$query=('INSERT "", $var1 INTO "speakers";'); $runquery=($query, $dbconn); //I know this isn't quite right, but you get the idea....[/code]What I need to know is how to I edit the second table mentioned above and keep the FK relationship...I'm new to splitting up my tables...usually for something like this I would just leave it on one...but I want to learn how to do it the right way....thanks guys... Link to comment https://forums.phpfreaks.com/topic/20950-inserting-data-into-two-tables/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.