L
L
lemonlimelike2017-05-09 13:20:53
PHP
lemonlimelike, 2017-05-09 13:20:53

Correct spelling of sql query?

Is this sql query correct?

$res = mysqli_query($connection, "SELECT * FROM `video_category` WHERE `category_id` AND `video_id` = " . (int)$_GET['id']);

Although in the database category_id and video_id 'ID' are different

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2017-05-09
@lemonlimelike

$res = mysqli_query($connection, "SELECT * FROM `video_category` WHERE `category_id` AND `video_id` = " . (int)$_GET['id']);
You don't have an ID for category_id in this request at all - this is the first time.
Secondly, if the IDs are different, then different ones need to be substituted - in the form where you request the ID, name them differently, for example category_id and video_id and then it will be $_GET['category_id'], $_GET['video_id'] - you do not need to name the variable id, but substitute a specific value.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question