作者:傻a2602909381 | 来源:互联网 | 2023-05-19 17:44
Imusingphpmyadminforawebsiteimcreatingandhaveaquestionaboutainsertingvaluesintofor
Im using phpmyadmin for a website i'm creating and have a question about a inserting values into foreign key.
我正在创建一个网站,我正在使用phpmyadmin,我有一个关于将值插入到外键的问题。
Im able to select an image table id when event col in events table is value x i.e...
当事件表中的事件col为值x时,我可以选择一个图像表id,即…
$event = "Partay";
$sql = "SELECT i.ImageID
FROM images i
INNER JOIN events e
ON i.eventID = e.eventID
WHERE e.event ='".$event."'";
This works for selecting images to display. However when i want to insert and image inner join doesnt seem to work the same.
这适用于选择要显示的图像。然而,当我想要插入和图像内连接时,似乎并没有起作用。
$sql = "INSERT INTO images i (i.image, e.event)
INNER JOIN event e
ON i.eventID = e.eventID
VALUES ('".$content."','".$event."')";
-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?
-Im尝试将图像插入到images表中,将一个新的事件插入到event表中,使这个新的图像属于这个新的事件。-当向已有事件插入图像时,如何插入工作?
Any help would be good thank you.
任何帮助都可以,谢谢。
3 个解决方案