I'm building a music website using php/mysql for my final year project at university. I'm trying to do a select query on the band_id and then insert the result into 2 more tables that have the band id as a foreign key.
$result="select (`band_id`) from band
where band_name = '$band_name'";
mysql_query($result, $dbh);
//$band_name is the value entered into the edit box on my form and seen as the query returns $result I was thinking I could just slot it into the other queries and it would work like so:
$sql="INSERT INTO `member` (`band_id`)
VALUES($result)";
mysql_query($sql, $dbh);
$sql="INSERT INTO `user` (`band_id`)
VALUES($result)";
mysql_query($sql, $dbh);
Obviousley it doesn't work.
Any help would be appreciated.
