php - Retrieving multiple queries from mysql using MySqli_fetch_array() -


so retrieving data mysqli different tables have foreign primary relation not doing getting data(selected columns) , showing in 1 html table doing this

while (($ans= mysqli_fetch_array($result))&&($ans1=mysqli_fetch_array($result1))&&($ans2=mysqli_fetch_array($result2))&&($ans3=mysqli_fetch_array($result3))&&($ans4=mysqli_fetch_array($result4)))                       {                         echo  "   <td>".$ans['name']."</td> ";                         echo  "   <td>".$ans1['id']."</td> ";                         echo  "   <td>".$ans2['company']."</td> "; } 

the problem here is not fetching records because of && operator , if implementing separate while loop on every query not displaying html table people

use sql union can avoid long conditions in queries

example

select city customers union select city suppliers 

note: cannot union queries not have same number of columns in select.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -