SQL: insert value into foreign key

coolkiddada

New Member
Im using phpmyadmin for a website i'm creating and have a question about a inserting values into foreign key.Im able to select an image table id when event col in events table is value x i.e...\[code\]$event = "Partay";$sql = "SELECT i.ImageIDFROM images i INNER JOIN events e ON i.eventID = e.eventIDWHERE e.event ='".$event."'";\[/code\]This works for selecting images to display. However when i want to insert and image inner join doesnt seem to work the same.\[code\]$sql = "INSERT INTO images i (i.image, e.event) INNER JOIN event e ON i.eventID = e.eventIDVALUES ('".$content."','".$event."')";\[/code\]-Im trying to insert image into images table and a new event into event table so that this new image belongs to this new event.-Also how would inserting work when inserting image with an existing event?Any help would be good thank you.
 
Back
Top