Jump to content

Help with shop.


DJTim666

Recommended Posts

I am currently coding usershops for my website where users will be able to sell their items. I need help making it so that users can price multiple items all at once. I am thinking maybe a foreach statement or something but I am not 100% sure.

 

What I want to happen is this;

 

The user has 20 items in their shop, they price all 20 items, and hit submit, and it prices all of those items.

 

Sorry if this doesn't make to much sense.

 

MSN: djtim2005@gmail.com

AIM: Freudian666

 

Feel free to add me so I can explain further :)!

 

--

DJ

Link to comment
Share on other sites

But, they would be updating all 20 items with different prices.

 

Here is the code I have so far;

 

<?php
require_once("core.php");
loggedin();

$shopID = $_GET['shopID'];
$shopID2 = mysql_query("SELECT * FROM usershops WHERE owner='" . $Yourname . "'");
$shopID3 = mysql_fetch_array($shopID2);

echo "<h3>Your Shop</h3>";
echo "<a href='$PHP_SELF?act=prices'>Edit Prices</a> | <a href='viewshops.php?shopID=" . $shopID3['id'] . "'>View Your Shop</a>";

if (!$act)
{
if (!mysql_num_rows($shopID2))
{
	echo "You don't have a Shop yet. Click <a href='$PHP_SELF?act=create'>here</a> to create one. Creating a shop costs 1,500 RBC.";
	die();
}
else
{
	echo "Welcome to user shops. Please navigate around using the links above.";
}
}
if ($act == 'create')
{
$description = $_POST['descrip'];
$shop_name = $_POST['shop_name'];
$safe_shop_name = mysql_real_escape_string(striptags($shop_name));
$safe_description = mysql_real_escape_string(striptags($description));
if (!isset($shop_name))
{
	echo "<form action='$PHP_SELF?act=create' method='post'>
		Shop Name: <input type='text' name='shop_name' /><br />
		Description: <input type='text' name='descrip' size='30' /><br />
		<input type='submit' value='Create Shop' />
		</form>";
}
if (isset($description))
{
	if (mysql_num_rows($shopID2))
	{
		showerror("You already have a shop. Why do you need another?");
	}
	if (empty($description) || empty($shop_name))
	{
		showerror("You left one of the required fields blank.");
	}
	if ($userinfo['point'] < 1500)
	{
		showerror("You don't have enough RBC to create a shop.");
	}
}
else
{
	mysql_query("INSERT INTO usershops(owner, description, shope_name) VALUES ('" . $Yourname . "', '" . $safe_description . "', '" . $safe_shop_name . "')");
	echo "You have just created a shop. You may now sell all the items you like.";
}
}		
if ($act == 'prices')
{
$query = mysql_query("SELECT * FROM user_items WHERE location=3 AND owner='" . $Yourname . "'");

echo "<table border='1' width='100%' bordercolor='blue'>
	<tr>
		<td><b>Item</b></td>
		<td><b>Price</b></td>
		<td><b>Remove</b></td>
	</tr>";

while ($row_shop = mysql_fetch_array($query))
{
	echo "<tr>
			<td><img src='" . $row_shop['image'] . "'><br />" . $row_shop['name'] . "</td>
			<td>lalala</td>
		</tr>";
}
}

require_once("footer.php");
?>

 

EDIT: Noticed a couple errors. Fixed them :P!

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.