T
T
Tange2015-08-01 13:55:00
PHP
Tange, 2015-08-01 13:55:00

How to make a selection in the select list from the database?

There is a regular list, and you need to display values ​​from the database into it, i.e., the list will change depending on what I write in the selection parameters, like: select from the table ... value ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wol_fi, 2015-08-01
@Tange

Not quite sure, do you need something like this?

$connection = new \PDO($params);
$statement = $connection->prepare(
   "SELECT field1,field2,fieldN FROM tableName WHERE field2 = :param1 AND field1 = :param2"
);
$statement->bindValue("param1", "blblabla", \PDO::PARAM_STR);
$statement->bindValue("param2", 100500, \PDO::PARAM_INT);
$statement->execute();
$list = $statement->fetchAll(\PDO::FETCH_ASSOC);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question