Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = ""; $username = ""; $password = ""; $dbname = "";
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());}
- $sql_1 = "SELECT id, title, main_image FROM posts WHERE $sql_2 = 'category_title' AND $sql_3 ='country_iso_code'";
- $sql_2 = "SELECT id, post_id, category_title FROM post_categories";
- $sql_3 = "SELECT id, post_id, country_iso_code FROM post_countries";
- $category_title =$_REQUEST['category'];
- $country_iso_code =$_REQUEST['country'];
- $result = mysqli_query($conn, $sql_1);
- if (mysqli_num_rows($result) > 0) {
- // output data of each row
- while($row = mysqli_fetch_assoc($result)) {
- echo "id: " . $row["id"]. " - Title: " . $row["title"]. " " . $row["main_image"]. "<br>";
- }
- } else {
- echo "0 results";
- }
- mysqli_close($conn);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement