hi,
i would like to ask your help about my code. i'm doing a borrowing form. what i really want to do is display the available data. i have a table workstation wherein it contains all the computer stations. i have a table borrow which contains the field ToolID, BrDate,BrFrom,Station,PIC,RtDate,RtTo,Authorized_B y.
In my combo box i only want to display the available station. The data displayed from the workstation table will depend on the borrow table. The station will only be displayed if in the borrow table ToolID and RtDate are not null.
i really don't know what to do. i'm still on the process of learning php.
thanks in advance.
<?php
$db=mysql_connect("localhost","root");
mysql_select_db("mydatabase",$db);
$query = "SELECT * FROM workstation ORDER BY station ASC";
$result = mysql_query($query) or die(mysql_error());
echo "<select name=\"Station\" size=\"1\">";
while($row = mysql_fetch_array($result))
{
$query1 = "select * from borrow where ToolID='$ToolID' and RtDate='$RtDate' and Station='$row'";
$result1 = mysql_query($query1) or die(mysql_error());
$row1=mysql_fetch_row($result1);
if ($row1[0]==0) {
echo "<option>".$row['station'];
}
}
echo "</select>";
?>