In einer Form innerhalb eines sqlsrv_fetch_array Ich habemehr als eine Variable in PHP-Arrays
<select class="styled-select" name="StockArray['.$row1['ProductID'].']" required><option selected></option><option>0</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option><option>11</option><option>12</option><option>13</option><option>14</option><option>15</option></select>
und auf der Seite nach, dass dieses Formular I foreach habe ein Insert zu konstruieren.
$InsertDate = date("Y-m-d H:i:s");
foreach ($_POST['StockArray'] as $ProductID => $Qty) {$InsertList .= "('".$ProductID."', '".$Qty."', '".$InsertDate."', '1'),";}
$InsertList = rtrim($InsertList, ',');
Was würde Ich mag eine zusätzliche Variable _POST innerhalb von $ passieren [ 'StockArray'] genannt row1 $ [ 'LastQty'] so kann ich eine zusätzliche Spalte in meinem Einsatz hinzufügen. Ich denke nicht, dass es technisch möglich ist, dass ein Array mehr als einen Wert pro Schlüssel hat, aber ich bin hier, um zu sehen, ob es einen Workaround dafür gibt, was ich versuche zu tun.
'StockArray [ = $ Row1 [ 'ProductID']?>]' Vielleicht – devpro
@devpro Ich bin nicht sicher, was auf dem ich suche, ich dort noch ID wollen Produkt aber ich würde auch mag auch $ row1 ['LastQty'] übergeben, zum Beispiel –