Jump to content

[SOLVED] Help With Building Option Box


atticus

Recommended Posts

I need help building a an option box.  Basically, the admin will select a user from one table and upload files to another table.  When that user logs in, they should be able to see those files that are associated with their name.  However, I do not know the best way to do it.  I would post my code, but I think I am going about the wrong way.  Any suggestions on how to do this would be greatly appreciated.

 

This is how my table structures are laid out

table_cust

field: cust_id

field: password

 

table_upload:

field:id

fields: (file info)

field: cust_id

Link to comment
Share on other sites

For the option box; this is what I came up with:

<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="2000000">
<label>
<select name="cust_id>
<?php
$sql = "SELECT * FROM cust";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)) {
echo "<option>".$row['cust_id']."</option>";
}
?>
</select>
<label>Title:</label><input type="text" name="title" id="title"><br /><br />
<label>File:</label><input name="userfile" type="file" id="userfile"><br /><br />
<label></label><td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload ">
</form>

 

However, this looks promising for retrieving the info:

 

Try this

 

SELECT c.file_info
FROM cust c
LEFT JOIN upload u
ON u.cust_id = c.cust_id

 

However, i am not sure how to use it. 

 

How do I associate the user name with the file when they are in two different tables?

 

Do I do it on the upload or in the results?

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.