Saya nk buat rekod pinjaman fail n memerlukan gabungan 3 table dr mysql..kat bwh ni adalah codingnya

interface

<? include("odbc.php");
include("banner.php");
include("homestaff.php");
?>

<html>

<head>
<script language="JavaScript" src="calendar.js"></script>
<title>borrow file record</title>

</head>

<body>

<br>
<table width="100%" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000" align="center">


<tr bgcolor="#FF5C0F">
<td align="right">
<a href="staff.php"><strong>Sign Up</strong></a>
</td>
</tr>


<tr align="center">
<td height="400" valign="top">

<form method="POST" name="form" action="borrowprocess.php">
<br><table align="center">
<tr>
<td width="104" height="36">Borrow Date :</td>
<td width="183"><input type="text" name="dateout">
<a href="javascript:show_calendar('form.dateout');" onMouseOver="window.status='dateout';return true;" onMouseOut="window.status='';return true;"><img src="images/b_calendar.png" width=16 height=16 border=0 align="middle"></a></td>
</tr>


<tr>
<td height="29">Staff No :</td>
<td><select name="staffno">
<option value="">Select</option>
<?
$sqlst = mysql_query("SELECT * FROM staff");
while($staf = mysql_fetch_array($sqlst))
{ ?>
<option value="<? echo $staf['staff_id'] ?>"<?php if($code['staff_id'] == $code1) echo ' selected="selected"'; ?>><? echo $staf['staffno'];?> </option>
<? } ?>
</select>
<a href="staffrecord.php?staff_id=<? echo $result['staff_id'];?><? echo $result['staff_name'];?>');">[details]
</a>


</tr>

<tr>
<td>File Name:</td>
<td><select name="item">
<option value="">Select File</option>
<?
$sqlst = mysql_query("SELECT * FROM item");
while($code = mysql_fetch_array($sqlst))
{ ?>
<option value="<? echo $code['item_id'] ?>"<?php if($code['item_id'] == $code1) echo ' selected="selected"'; ?>><? echo $code['item_name'];?> </option>
<? } ?>
</select></td>
</tr>

<tr>
<td>Return Date :</td>
<td><input type="text" name="datein">
<a href="javascript:show_calendar('form.datein');" onMouseOver="window.status='datein';return true;" onMouseOut="window.status='';return true;"><img src="images/b_calendar.png" width=16 height=16 border=0 align="middle"></a></td>

</tr>

<tr>
<td colspan="2" align="center"><input type="submit" name="hantar" value="ADD">
<input type="reset" name="padam" value="CANCEL"></td></tr>
</table>
</form>

<table align="center" border="1" bordercolor="#000000" width="100%">

<tr bgcolor="#FF5C0F">
<td colspan="7" align="center"><strong>BORROW FILE RECORD</strong></td>
</tr>

<tr>
<td width="7%" align="center"><strong>No</strong></td>
<td width="13%" align="center"><strong>Borrow Date </strong></td>
<td width="13%" align="center"><strong>Staff No</strong></td>
<td width="18%" align="center"><strong>File Name </strong></td>
<td width="12%" align="center"><strong>Return Date </strong></td>
<td width="20%" align="center"><strong>Action</strong></td>
</tr>

<?
//select data
$i=1;
$sqlstmt = mysql_query("SELECT item.*, borrow.*, staff.*
FROM item
RIGHT JOIN borrow ON borrow.borrow_id=item.borrow_id
RIGHT JOIN staff ON staff.staff_id = item.staff_id");

while($result = mysql_fetch_array($sqlstmt))
{
?>

<tr>
<td height="31"><? echo $i;?>&nbsp;</td>
<td><? echo date('d-m-Y',strtotime($result['dateout']));?>&nbsp;</td>
<td><? echo $result['staffno'];?>&nbsp;</td>
<td><? echo $result['item_name'];?>&nbsp;</td>
<td><? echo date('d-m-Y',strtotime($result['datein']));?>&nbsp;</td>

<td align="center"><p><a href="deleteborrow.php?borrow_id=<? echo $result['borrow_id'];?>" onClick="return confirm('Are You Sure To Delete? \n <? echo $result['staff_name'];?>');"><img src="images/butdel.jpg" border="0"></a>&nbsp;
<a href="editborrow.php?borrow_id=<? echo $result['borrow_id'];?>" onClick="return confirm('Are You Sure To Edit? \n <? echo $result['staff_name'];?>');"><img src="images/butedit.jpg" border="0"></a>
</p>
</td>


</tr>


<?
$i++;
} ?>

</table>

</td>
</tr>

<tr bgcolor="#FF5C0F">
<td>&nbsp;</td>
</tr>



</table>

</body>
</html>

process

<?php
include("odbc.php");
$dateout=$_POST['dateout'];
$dateout = substr($dateout,6,4)."_".substr($dateout,3,2)."_". substr($dateout,0,2);
$staffno = $_POST['staffno'];
$item= $_POST['item'];
$datein = $_POST['datein'];
$datein = substr($datein,6,4)."_".substr($datein,3,2)."_".su bstr($datein,0,2);


$query_add_data = "INSERT INTO borrow(dateout,staffno,item_name,datein) VALUES ('$dateout','$staffno','$item','$datein')";
$result = mysql_query($query_add_data);

echo "<META HTTP-EQUIV=Refresh CONTENT=\"3; URL=borrowrecord.php\">";
?>

error yg dipaparkan

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\system\borrowrecord.php on line 105

saya dh cuba ubah sane sini x jadi gak..contoh right join sy dh ubah kepada inner join n left join..tp x berjaya