<?php 
	include 'connection.php';
	$qry = mysql_query( "SELECT g.totalDaily, p.COUNT(DISTINCT bodyNo) AS qty FROM grandTotal AS g, paintshop  AS p ") or die('error');
	while ($rows = mysql_fetch_array($qry)){ 
	?>
    <td><?php $dpu = $rows['g.totalDaily'] / $rows['qty'];
	            echo $dpu;?></td> <?php } ?>

i want to display the $dpu which is defect per unit..the information must get from 2 table like above codes. the problem is when i want to display it no result. i hope u guys can help me...:-/

You need a WHERE clause to link the two result together.

You need a WHERE clause to link the two result together.

i dont have fields in paintshop and grandTotal are same there..how come i want to make WHERE clause?

<?php
$sql="SELECT * FROM profile,role WHERE role.id=profile.role_id";
$query=mysql_query($sql);
while($result=mysql_fetch_array($query)){

$result['username'];
}
?>

i dont have fields in paintshop and grandTotal are same there..how come i want to make WHERE clause?

Perhaps I misunderstood, could you give an example of your expected output ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.