I am trying to save a record in to MSSQL server data base from multiple checkboxes using PHP-jQuery
But this error appears.
The problem is in PHP code, how to read this string and record this data in MSSQL DB?
if(isset($_POST['buttonsave']))
{ //echo "bttnsave"; // Mensaje Afirmativo.
$vfpg = $_POST['perGrupo'];
$vfdg = $_POST['depGrupo'];
$vfsg = $_POST['selGrado'];
$vfchs = $_POST['myCheckboxes']; // Array secciones A,B,C,..
$query_in="INSERT INTO igrupos (idperiodo, idcarrera, grado, seccion)
VALUES (?,?,?,?)";
for ( $i=0; $i < count( $vfchs ); $i++ )
{
// do some stuff, save to database, etc.
$params = array(
array($vfpg ,SQLSRV_PARAM_IN),
array($vfdg ,SQLSRV_PARAM_IN),
array($vfsg ,SQLSRV_PARAM_IN),
array($vfchs ,SQLSRV_PARAM_IN)
);
}
$sql_in = sqlsrv_query($conn,$query_in,$params);
if ($sql_in) // Se eejectuto la sentencia SQL?
{
echo "SQLSuccess"; // Affirmative message.
} else {
$msgErrorSQL = "Error SQL not working"; // Negative Message;
die( print_r( sqlsrv_errors(), true)); // Causa del error.
}
exit();
}
Thanks a lot!
Aucun commentaire:
Enregistrer un commentaire