C
C
Chesterfield252021-06-12 12:32:39
PHP
Chesterfield25, 2021-06-12 12:32:39

How to use prepared queries?

I have a request to read data, read. What is the correct way to use prepared query for reading?

My request

$sql = $pdo->prepare("SELECT xf_list.id as id_f, xf_list.title as title_f, xf_list.url as url_f, xf_category.id as id_c, xf_category.title as title_c, xf_type.title as title_t, xf_type.url as url_t FROM `xf_list` LEFT JOIN `xf_category` ON `xf_list` . `category_id`=`xf_category` . `id` LEFT JOIN `xf_type` ON `xf_list` . `type_id`=`xf_type` . `id`");
$sql->execute();
$result = $sql->fetchAll(PDO::FETCH_OBJ);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nokimaro, 2021-06-12
@nokimaro

3 minutes to read
https://www.php.net/manual/ru/pdo.prepared-stateme...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question