Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

Mysql UNION Query

by
Category:mysql
mysql
Mysql UNION Query

The UNION query is used to combine the result-set of two or more SELECT statements.

Unions combine the results from multiple SELECT queries into a consolidated result set.

First you can need database connection in php

Code

$sql = "SELECT * FROM product UNION SELECT * FROM users"; 
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_assoc($result))
{

}

0 Comments


Html code work in comment box


Related Post