june_c21 Posted November 12, 2007 Share Posted November 12, 2007 hi, i not sure what wrong with my code , it return empty result. SELECT id, month, start_date, end_date, user.name, report.staff_no,details,amount,gl_code,user.bank,user.acc_no,status FROM user,report WHERE report.staff_no = user.staff_no Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 12, 2007 Share Posted November 12, 2007 report.staff_no = user.staff_no check if that condition is really satisfied ... or you might use left join Quote Link to comment Share on other sites More sharing options...
june_c21 Posted November 12, 2007 Author Share Posted November 12, 2007 i try left join but it doesn't work Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 12, 2007 Share Posted November 12, 2007 can we see your php code within that statement? Quote Link to comment Share on other sites More sharing options...
june_c21 Posted November 12, 2007 Author Share Posted November 12, 2007 $query = "SELECT id, month, start_date, end_date, user.name, report.staff_no,details,amount,gl_code,user.bank,user.acc_no,status FROM user,report WHERE report.staff_no = user.staff_no"; $result = mysql_query($query, $dblink); while($myrow = mysql_fetch_row($result)) { echo "<tr><td><span class=style2>" . $myrow[0] . "</span</td>"; echo "<td><span class=style2>" . $myrow[1] . "</span</td>"; echo "<td><span class=style2>" . $myrow[2] . "</span</td>"; echo "<td><span class=style2>" . $myrow[3] . "</td></span>"; echo "<td><span class=style2>" . $myrow[4] . "</span></td>"; echo "<td><span class=style2>" . $myrow[5] . "</span></td>"; echo "<td><span class=style2>" . $myrow[6] . "</span></td>"; echo "<td><span class=style2>" . $myrow[7] . "</span></td>"; echo "<td><span class=style2>" . $myrow[8] . "</span></td>"; echo "<td><span class=style2>" . $myrow[9] . "</span></td>"; echo "<td><span class=style2>" . $myrow[10] . "</span></td>"; echo "<td><span class=style10>" . $myrow[11] . "</span></td>"; Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 12, 2007 Share Posted November 12, 2007 <? $query = "SELECT id, month, start_date, end_date, user.name, report.staff_no,details,amount,gl_code,user.bank,user.acc_no,status FROM user,report WHERE report.staff_no = user.staff_no"; $result = mysql_query($query, $dblink) or die (mysql_error()); print_r(mysql_fetch_assoc($result )); ?> paste here the output... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.