Connor: Multieingaben via HTML/PHP an MySQL

Beitrag lesen

Hi Chris,

habs mit dem IN Befahl hinbekommen danke.

Mein Code ist aber recht grausam. Aber es geht.

Code in PHP:

<?php

include("db_connect.php");

// In Liga1 eintragen Post kommt aus HTML
$id1 = $_POST["id1"];
$id2 = $_POST["id2"];
$id3 = $_POST["id3"];
$id4 = $_POST["id4"];
$id5 = $_POST["id5"];
$id6 = $_POST["id6"];
$id7 = $_POST["id7"];
$id8 = $_POST["id8"];
$id9 = $_POST["id9"];
$id10 = $_POST["id10"];
$id11 = $_POST["id11"];
$id12 = $_POST["id12"];
$id13 = $_POST["id13"];
$id14 = $_POST["id14"];
$id15 = $_POST["id15"];
$id16 = $_POST["id16"];
$id17 = $_POST["id17"];
$id18 = $_POST["id18"];

$sql="select * from user";
$sql= "select * from liga_1";
$nachliga1 = mysql_query(" INSERT INTO liga_1 (ID,pname) SELECT ID,pname FROM user WHERE ID IN ('$id1','$id2','$id3','$id4','$id5','$id6','$id7','$id8','$id9','$id10','$id11','$id12','$id13','$id14','$id15','$id16','$id17','$id18') ");

?>