My parameters have different names (tags, tags2, tags3) but the same GET method or in other words the same column name (tags) in the MySQL database.
Here is the code:
$tags = $_GET['tags'];
$tags2 = $_GET['tags'];
$tags3 = $_GET['tags'];
$fetch = mysqli_query($conn, "SELECT * FROM users JOIN user_images ON users.username = user_images.username WHERE tags = '$tags' AND tags = '$tags2' AND tags = '$tags3' ORDER BY users.id DESC");
Basically I am trying to display all images with 3 different tags in the user_images tables.
Here is what my URL looks like, but it only displays one tag and not all 3:
https://www.example.com/app/user-tags.php?tags=aesthetic&tags2=food&tags3=dogs
The first parameter works, but not all of them. Can anyone help me where I went wrong?
I thought about doing something likes this, having tags = aesthetic,food,dogs in the query. But the problem is that I think the result would read that as, "Find all images with the tags of aestheticfooddogs" instead of tags with aesthetic, food, and dogs.
$tags2 = $_GET['tags'];to$tags2 = $_GET['tags2'];and do the same for tags3.$tags3, but this time nothing displays. I thought the$_GETholds the name of the column from the SQL Database, that's why I kept it the same.$_GETis the array of parameters from the URL. The sample URL you used has 3 names and values, tags, tags2 and tags3. tags contains aesthetic, tags2 contains food and tags3 contains dogs. If youvar_dump($_GET);before the code you posted what do you get?array(3) { ["tags"]=> string(9) "aesthetic" ["tags2"]=> string(4) "food" ["tags3"]=> string(4) "dogs" }. I also did it to the $_GET changes and got the same results.$tags2 = $_GET['tags2'];will result in$tags2containingfood. You confusion is in your SQL query. How is yourtagscolumn in SQL defined?