samuel gast
samuel gast

Reputation: 372

How can I use the bind_param() with multiple params

So I have a table with the colums title,description,created, fk_u. Then I have this statement:

$stmt = $conn->prepare( "insert into blogs1(title,description,created,fk_u) values(?,?,?,?)");

Afterwards I try to bind the parameters with bind_param().

$stmt->bind_param("ssii", $title,$desc,NOW(),$id);

The Problem I get is that it dosen't recognise the NOW() function. What could be the error. Am I using the bind_param function wrong?

Upvotes: 0

Views: 309

Answers (1)

Nigel Ren
Nigel Ren

Reputation: 57121

NOW() is MySQL, so move this to your SQL and remove the bind...

$stmt = $conn->prepare( "insert into blogs1(title,description,created,fk_u) 
                  values(?,?,NOW(),?)");

$stmt->bind_param("ssi", $title,$desc,$id);

Upvotes: 3

Related Questions