Cant insert "FormID" into database

Hi
I have a problem with inserting into one tabel. I have one other “Insert” before in the code, that works just fine. I can’t figure out what is wrong. Could anyone help?

$aId3 = $_POST[‘formID’];

$stmt = $con->prepare(“INSERT INTO OrdreDetalierT (OrdreID, UVmaterialeID )
VALUES (?, ?)”);

for($i=0; $i < $N; $i++)

{
$stmt->bind_param(‘isi’, $Ordre_id, $aId3[$i] );
$stmt->execute();
}
$stmt->close();

First are you using PDO or mysqli? It will make a difference, but what jumps out at me the most, if you are using mysqli:

You are attempting to bind a integer, a string, and an integer, but only passing two arguments.

It is mysql. Actually I had changed it, so it now is:
$stmt->bind_param(‘is’, $Ordre_id, $aId3[$i] );

mysql or mysqli?

Turn error reporting on and see what the specific error it is reporting.

It´s mysqli - sorry:-)

This is an error I get: Undefined index: searchFag in /customers/8/f/a/ellebaekskolen2.dk/httpd.www/Indkoeb/order.php on line 73

I think the website has got a new version, so maybe that is the problem, since it all worked before. I´ll check it out.

Well that error has nothing to do with the code you posted, so I can’t help without more information.

Actually you helped me by giving me the tip to turn error reporting on. I found the error, and you were right, it had nothing to do with the code, but with the database.

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service