sjones Posted March 5, 2006 Share Posted March 5, 2006 Hello,I have setup four tables in my database.[u][b]Vendors [/b] [/u] vendor_id vendor_name cat_id coupon_id[u][b]categories[/b][/u] cat_id parent_id cat_name[u][b]coupons[/b][/u] coupon_id coupon_image vendor_id start_date modified_date image_path upload_id[u][b]uploads[/b][/u] upload_id file_name file_size file_type description date_entered image_path _________________________________________________________________________I have created a form to allow the [b]administrator[/b] to select a vendor from the list and then browse to the file that they would like to upload. The image that they upload will correspond with the vendor. My question is this - I would like to get the [b]vendor_id [/b]and place it in the coupons table. [b]OK this gets more confusing the more I think about it!![/b]The end result should be on the index.php page a [b]user[/b] would be able to select a category and then select a vendor when they select that vendor the image will appear. If anyone can tell me how they would approach this or point me in the right direction I would appreciate it. [a href=\"http://www.uswebproducts.com/country_savings/admin/csmag_admin.php?c=add_image\" target=\"_blank\"]Here's the link[/a]I will include the script below.<td class='content_blank' valign='top' colspan="2"><?php include ('../connections/mysql_connect.php'); echo "<strong>Add an Image</strong><BR> You Must select a vendor, then browse to their coupon image and upload the file<BR><BR>"; echo "</td> </tr> <tr> <td> <span class='content_blank'><strong>Select a vendor.</strong></span> <form enctype='multipart/form-data' method='post' action='csmag_admin.php?c=add_image.php'> <select name='vendor_id'> <option>- Please select one -</option>\n"; $qry = mysql_query("SELECT * FROM vendors;"); while($rows = mysql_fetch_assoc($qry)) { echo "<option value='".$rows['vendor_id']."'>".$rows['vendor_name']."</option>\n"; } echo "</td> <td> </select><input type='hidden' name='MAX_FILE_SIZE' value='20000'><span class='content_blank'><strong>Filename:</strong></sapn><INPUT NAME='userfile' TYPE='file'><br><br></FORM> <div align='right'><input name='submit' type='submit' value='Add Image'></div> </form>";?></td> Link to comment https://forums.phpfreaks.com/topic/4154-need-help-with-query/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.