Home Display Result from two tables sql using php
Reply: 0

Display Result from two tables sql using php

user1471
1#
user1471 Published in April 22, 2018, 5:59 pm

I have 2 tables, called post and pcgames

if $_GET['game']; is =action

it will seach action on table post and pcgames from column category.

post table

id|category  |game
------------------
1 | action   |cabal
------------------
2 | strategy |blackdessert
------------------
3 | RPG      |MUlegend
------------------
4 | action   |ragnarok
------------------

pcgames table

id|category  |game
-------------------
1 | action   |solidsnake
-------------------
2 | action   |finalfantasy
-------------------
3 | RPG      |kingdomhearts
-----------------
4 | action   |tekken
-------------------

result

no|category  |game
------------------
1 | action   |cabal
------------------
2 | action   |solidsnake
-------------------
3 | action   |finalfantasy
-------------------
4 | action   |tekken
-------------------

PHP

    <?php
    $game = $_GET['game'];
    $ids = mysqli_real_escape_string($conDB,$id);
    $query = "SELECT * FROM `post` WHERE `game` ='" . $game . "'";
    $result = mysqli_query($conDB,$query);
    while($row = mysqli_fetch_array($result)) {
?> 
        <li> <a href="./post_list.html"><?php echo $row['title']; ?></a> </li>
<?php }; ?> 
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.309057 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO