0
<?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...:-/

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by pritaeas
0

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?

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

$result['username'];
}
?>
0

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 ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.