Skip to main content
Post Closed as "Duplicate" by miken32 php
added 30 characters in body; edited title
Source Link
silkfire
  • 26.3k
  • 17
  • 92
  • 116

Insert multiple rows with PDO aus array Multiinsert statement

I have a multi-checkboxmulticheckbox in a form<form> tag like this:

<input type="checkbox" name="del[]" value="<?php echo $menuItems['id']; ?>">

<input type="checkbox" name="del[]" value="<?php echo $menuItems['id']; ?>"> 

I ask this form with this code:

if (isset($_POST['subgruppe'])) {   $ids = array(); foreach ($_POST['del'] as $pval) { $ids[] = (int) $pval; }   $ids = implode(',', $ids); echo "groupids"; echo $ids; echo "userid:"; echo $_POST['userid']; 

This shows me a result like this:

groupids13,9...userid:5 

I need a statementstatment that give me a result like this:

INSERT INTO user_groups (usergroup, userid) VALUE (13,5),(9,5) 

Can... Can you give me a hint how i can check this? I I think I can handlehandel a solution that give me: (13,5),(9,5)... into a variable.

(13,5),(9,5)... in a variable 

THanks a lot:)

PDO aus array Multiinsert statement

I have a multi-checkbox in a form tag like this:

<input type="checkbox" name="del[]" value="<?php echo $menuItems['id']; ?>">

I ask this form with this code:

if (isset($_POST['subgruppe'])) { $ids = array(); foreach ($_POST['del'] as $pval) { $ids[] = (int) $pval; }   $ids = implode(',', $ids); echo "groupids"; echo $ids; echo "userid:"; echo $_POST['userid']; 

This shows me a result like this:

groupids13,9...userid:5 

I need a statement that give me a result like this:

INSERT INTO user_groups (usergroup, userid) VALUE (13,5),(9,5) 

Can you give me a hint how i can check this? I think I can handle a solution that give me:

(13,5),(9,5)... in a variable 

Insert multiple rows with PDO

I have a multicheckbox in a <form> tag like this:

<input type="checkbox" name="del[]" value="<?php echo $menuItems['id']; ?>"> 

I ask this form with this code:

if (isset($_POST['subgruppe'])) {   $ids = array(); foreach ($_POST['del'] as $pval) { $ids[] = (int) $pval; } $ids = implode(',', $ids); echo "groupids"; echo $ids; echo "userid:"; echo $_POST['userid']; 

This shows me a result like this:

groupids13,9...userid:5 

I need a statment that give me a result like this:

INSERT INTO user_groups (usergroup, userid) VALUE (13,5),(9,5) 

... Can you give me a hint how i can check this? I think I can handel a solution that give me: (13,5),(9,5)... into a variable.

THanks a lot:)

added 1 character in body
Source Link
AbraCadaver
  • 79.2k
  • 7
  • 75
  • 91

I have a multi checkbox-checkbox in a form tag like this:

<input type="checkbox" name="del[]" value="<?php echo $menuItems['id']; ?>">

I ask this form with this code:

if (isset($_POST['subgruppe'])) { $ids = array(); foreach ($_POST['del'] as $pval) { $ids[] = (int) $pval; } $ids = implode(',', $ids); echo "groupids"; echo $ids; echo "userid:"; echo $_POST['userid']; 

This shows me a reultresult like this:

groupids13,9...userid:5 

I need a statement that give me a result like this:

INSERT INTO user_groups (usergroup, userid) VALUE (13,5),(9,5) 

Can you give me a hint how i can check this? I think I can handle a solution that give me:

(13,5),(9,5)... in a variable 

I have a multi checkbox in a form tag like this:

<input type="checkbox" name="del[]" value="<?php echo $menuItems['id']; ?>">

I ask this form with this code:

if (isset($_POST['subgruppe'])) { $ids = array(); foreach ($_POST['del'] as $pval) { $ids[] = (int) $pval; } $ids = implode(',', $ids); echo "groupids"; echo $ids; echo "userid:"; echo $_POST['userid']; 

This shows me a reult like this:

groupids13,9...userid:5 

I need a statement that give me a result like this:

INSERT INTO user_groups (usergroup, userid) VALUE (13,5),(9,5) 

Can you give me a hint how i can check this? I think I can handle a solution that give me:

(13,5),(9,5)... in a variable 

I have a multi-checkbox in a form tag like this:

<input type="checkbox" name="del[]" value="<?php echo $menuItems['id']; ?>">

I ask this form with this code:

if (isset($_POST['subgruppe'])) { $ids = array(); foreach ($_POST['del'] as $pval) { $ids[] = (int) $pval; } $ids = implode(',', $ids); echo "groupids"; echo $ids; echo "userid:"; echo $_POST['userid']; 

This shows me a result like this:

groupids13,9...userid:5 

I need a statement that give me a result like this:

INSERT INTO user_groups (usergroup, userid) VALUE (13,5),(9,5) 

Can you give me a hint how i can check this? I think I can handle a solution that give me:

(13,5),(9,5)... in a variable 
edited body
Source Link
AbraCadaver
  • 79.2k
  • 7
  • 75
  • 91

iI have a multicheckboxmulti checkbox in a form-tag tag like this: ">

<input type="checkbox" name="del[]" value="<?php echo $menuItems['id']; ?>">

I ask this form with thosthis code: if (isset($_POST['subgruppe'])) { $ids = array();

if (isset($_POST['subgruppe'])) {  $ids = array(); foreach ($_POST['del'] as $pval) { $ids[] = (int) $pval; } $ids = implode(',', $ids); echo "groupids"; echo $ids; echo "userid:"; echo $_POST['userid']; 

This shows me a reult like this: groupids13,9...userid:5

groupids13,9...userid:5 

I need a statmentstatement that give me a result like this:

INSERT INTO user_groups (usergroup, userid) VALUE (13,5),(9,5) 

... Can Can you give me a hint how i can check this? I I think I can handelhandle a solution that give me: (13,5),(9,5)... in a variabel

THanks a lot:)

(13,5),(9,5)... in a variable 

i have a multicheckbox in a form-tag like this: ">

I ask this form with thos code: if (isset($_POST['subgruppe'])) { $ids = array();

 foreach ($_POST['del'] as $pval) { $ids[] = (int) $pval; } $ids = implode(',', $ids); echo "groupids"; echo $ids; echo "userid:"; echo $_POST['userid']; 

This shows me a reult like this: groupids13,9...userid:5

I need a statment that give me a result like this:

INSERT INTO user_groups (usergroup, userid) VALUE (13,5),(9,5) 

... Can you give me a hint how i can check this? I think I can handel a solution that give me: (13,5),(9,5)... in a variabel

THanks a lot:)

I have a multi checkbox in a form tag like this:

<input type="checkbox" name="del[]" value="<?php echo $menuItems['id']; ?>">

I ask this form with this code:

if (isset($_POST['subgruppe'])) {  $ids = array(); foreach ($_POST['del'] as $pval) { $ids[] = (int) $pval; } $ids = implode(',', $ids); echo "groupids"; echo $ids; echo "userid:"; echo $_POST['userid']; 

This shows me a reult like this:

groupids13,9...userid:5 

I need a statement that give me a result like this:

INSERT INTO user_groups (usergroup, userid) VALUE (13,5),(9,5) 

Can you give me a hint how i can check this? I think I can handle a solution that give me:

(13,5),(9,5)... in a variable 
Source Link
Ingo
  • 27
  • 1
Loading