H
H
hello world2015-11-06 14:51:56
PHP
hello world, 2015-11-06 14:51:56

How to display comments and is such code dangerous?

How to display comments for a hotel if there are 2 tables?
Table a:
id |name|descr|adress
Table b:
id|id_hotel|user_name Comments are
required. Each hotel has its own comments. I got confused in the SQL query because I have not yet done it with a check for GET['id']. I forgot to say that in the request I want to immediately display the hotel data on the page + comments to it.

$id = $_GET['id'];
  $stmt = $pdo->prepare('SELECT comments.id_hotel, hotel.* FROM comments, hotel ');
  $stmt->execute(array(':id' => $id));
  $comments = $stmt->fetchAll();
  return $comments;

And tell me, is such a request vulnerable?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question