Domanda

I have a many things to insert into database colums.

    $connect->prepare("INSERT INTO users (username, password, message, date, time, id) VALUES (:username, :password, :message, :date, :time, :id");

Instead of binding them all, I created a array:

    $IDs = array($username, $password, $message, $time, $date, $ID);

How do I take each variable from this array and bind it? I am completely lost with PDO.

È stato utile?

Soluzione

use:

$sth->execute(array(':username' => $username, ':password' => $password, $message, $time, $date, $ID))

and for others...

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top