Q:

Selected 2 tables but outputs all from 1 and only 1 from second table - php mysql

here is my code:
<?php
global $liID, $liClass;
$liV = "SELECT * FROM css";
$li1 = mysqli_query($connect,$liV);
$li = mysqli_fetch_array($li1);
$liID = $li['liID'];
$liClass = $li['liClass'];

$post = "SELECT * FROM post ORDER BY id DESC LIMIT 5";
$post1 = mysqli_query($connect,$post);
$postV = mysqli_fetch_array($post1);

do {
    printf("<a href='view.php?id=%s'><li id='%s' class='%s'><img src='%s'><div class='tip'><h5>%s</h5></div></li></a>",$postV['id'],$li['liID'],$li['liClass'],$postV['slimg'],$postV['title']);
}
while ($postV = mysqli_fetch_array($post1) && $li = mysqli_fetch_array($li1));

?>

result is that, i have data only from "css" exactly as i need,
but from "post" i have only one data.

A:

You've got horribly constructed logic. Your while() condition is NOT doing what you expect, and is being parsed/executed as
while($postV = (fetch($post1) && ($li = fetch($li1)))) {

Note the positioning of the brackets. $postV is getting the result of the boolean && of your two fetch calls. As long as both return non-falseish values, $postV will simply become a boolean TRUE. e.g. it's the equivalent of:
$x = 'foo';
$y = 'bar';
$p = $x && $q = $y;
var_dump($p);

This will output a boolean true, not foo as you're expecting it to. 
Try this instead:
while (($postV = mysqli_fetch_array($post1)) && ($li = mysqli_fetch_array($li1)));
       ^-----------------------------------^    ^------------------------------^

Note the indicated extra brackets.

