Вопрос

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.

Это было полезно?

Решение

use:

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

and for others...

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top