Jump to content

Need help with query?


sjones

Recommended Posts

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
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.