简体   繁体   中英

SQL PHP INSERT INTO tables

Is it possible to INSERT INTO multiple tables for this?

SELECT first_name, last_name, feet, inche, weight, dob, college, pob, experience, cy, py
FROM player 
INNER JOIN attribute ON player.pid = attribute.pid
INNER JOIN history ON player.pid = history.pid
INNER JOIN salary ON player.pid = salary.pid

How do I join the tables for:

if(!($stmt = $mysqli->prepare("INSERT INTO player(first_name, last_name) VALUES (?, ?)"))){
   echo "Prepare for player failed: "  . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->bind_param("ss", $_POST['first_name'],$_POST['last_name']))){
    echo "Bind failed: "  . $stmt->errno . " " . $stmt->error;
}

MySQL doesn't support insert into multiple tables via single insert statement, I believe Oracle is only support it.

But you can use a Transaction to make sure all insert statements execute via single transaction.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM