Jump to content

Problem to insert array in MySQL


vearns

Recommended Posts

hello,

this is what i want to do :

 

questionjo4.jpg

 

user choose the student,select the package and submit.

i used array ($_POST['actions2']) for each of the checkbox to store student id.

 

here is my php code :

 

$package = $_POST['package'];

$check_borrowbook = mysql_query("SELECT * FROM spbtborrow WHERE bookpackage = '$package' and studentid in('" . implode("','", $_POST['actions2']) . "')");

$found = mysql_num_rows($check_borrowbook);

if ($found == 0) {

mysql_query("Insert into spbtborrow(studentid,bookpackage) Values(I DONT KNOW THE CODE TO PUT HERE,'$package')");

}

 

ok...so my problem is...how to put student id from the array into the sql.

 

it has something to do with :

 

studentid in('" . implode("','", $_POST['actions2']) . "')

 

rite ?

 

im really2 lost and need your help.

thanks

Link to comment
https://forums.phpfreaks.com/topic/132239-problem-to-insert-array-in-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.