Here is my setup. I have a Drop-Down list of clients that displays a table of their information below it. This displays Name, Address and a lot of other stuff. This works just great.
I just added an attachments section last night to the client with a seperate table in MYSQL. So, I have two tables in MYSQL, Client Information and Attachments. Each table as an ID to join one another, but my problem is that I just don’t know the correct query command to display only the attachments for that individual client.
Below isn’t obviously all the code and I know isn’t close to right. I assume I just need to figure out how to associate “clientid_files” with the selected item id from the drop-down box. The belows code displays all of the matching items that are matching amongst the two tables.
Again, I want to display only the attachments associated with selected client from the drop-down list.
Here is what I have:
[CODE]<?
$query = “SELECT clientid_files, id, name, size, created “.
“FROM file, clients “.
“WHERE clientid_files = id”;
$result = mysql_query($query) or die(mysql_error());
?>
<?
while($row = mysql_fetch_array($result)){
echo ”
<tr>
<td>{$row[‘name’]}</td>
<td>{$row[‘size’]}</td>
<td>{$row[‘created’]}</td>
<td><a href=’up/get_file.php?id_files={$row[‘id_files’]}’>Download</a></td>
<td><a href=’up/deletefile.php?id_files={$row[‘id_files’]}’>Delete</a></td>
</tr>”;
}
echo ‘</table>’;
?>
</center>
</form>