Jump to content


Photo

Need help with query?


  • Please log in to reply
No replies to this topic

#1 sjones

sjones
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 05 March 2006 - 06:28 PM

Hello,
I have setup four tables in my database.

Vendors
vendor_id
vendor_name
cat_id
coupon_id

categories
cat_id
parent_id
cat_name

coupons
coupon_id
coupon_image
vendor_id
start_date
modified_date
image_path
upload_id

uploads
upload_id
file_name
file_size
file_type
description
date_entered
image_path

_________________________________________________________________________

I have created a form to allow the administrator 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 vendor_id and place it in the coupons table. OK this gets more confusing the more I think about it!!
The end result should be on the index.php page a user 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>






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users