vearns Posted November 11, 2008 Share Posted November 11, 2008 hello, this is what i want to do : 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 More sharing options...
zenag Posted November 11, 2008 Share Posted November 11, 2008 .....assign post values to variable before insert action... $studid=implode(',',$_POST['actions2']); mysql_query("Insert into spbtborrow(studentid,bookpackage) Values('$studid','$package')"); Link to comment https://forums.phpfreaks.com/topic/132239-problem-to-insert-array-in-mysql/#findComment-687475 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.