Add to cart ! inside php table ! litle help

Hello

i am trying for cuple days to make shoping cart for my web page, here is what i have and what i need

i make slq DB that holds over 3000 artikls , i make php page that display arikles from sql , i need a code that will put specific artikle in shoping cart , i was downloading some simple shoping carts try to implemen them in my table but no luck ! i need help with my php script here is code of my file where i need to implement a Button that will add specific row in shoping cart … i am new in this coding. so i need litle help

sorry for my ENG

[php]
.imagetable {
font-family: verdana,arial,sans-serif;
font-size:8px;
color:#333333;
text-align: center;
vertical-align: super;
display: table-cell;
border-width: 1px;
border-color: #999999;
border-collapse: collapse;
}
.imagetable th {
background:#b5cfd2 url(‘cell-blue.jpg’);
font-size:12px;
border-width: 1px;
padding: 0.2px;
border-style: solid;
border-color: #999999;
}
.imagetable td {
background:#dcddc0 url(‘cell-grey.jpg’);
font-size:11px;
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #999999;
}

<?php include("includes/db.php"); include("includes/functions.php"); if($_REQUEST['command']=='add' && $_REQUEST['productid']>0){ $pid=$_REQUEST['productid']; addtocart($pid,1); header("location:shoppingcart.php"); exit(); } ?> Products
d = Drahtstärke All 0.2 0.25 0.30 0.40 0.50 0.55 0.60 0.70 0.80 0.90 1.00 1.20 1.30 1.40 1.50 1.60 1.70 1.80 1.90 2.00 2.20 2.50 3.00 3.50 4.00 5.00 6.00 7.00 De = Aussendurchmesse All 2.50 3.00 3.50 3.90 4.00 4.50 5.00 5.50 5.60 5.70 6.00 6.20 6.30 6.50 7.00 7.30 7.50 7.80 8.00 8.20 8.50 8.70 8.80 9.00 9.50 9.70 10.00 10.50 10.70 11.00 11.20 11.30 11.50 11.70 11.90 12.00 12.50 12.70 13.00 13.20 13.50 13.70 14.00 14.25 14.50 15.00 15.25 15.50 16.00 16.50 17.00 17.50 18.00 18.50 19.00 19.50 19.80 20.00 20.50 21.00 21.50 22.00 22.50 23.00 23.50 24.00 24.50 25.00 25.50 26.00 26.50 27.00 27.50 28.00 28.50 29.00 29.50 30.00 30.50 31.00 31.50 32.00 32.50 33.00 33.50 34.00 34.50 35.00 35.50 36.50 37.00 38.00 39.00 40.00 41.00 42.00 43.00 44.00 45.00 46.00 47.00 48.00 49.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00 120.00 Lo = Federlänge ungespannt All 2.00 2.30 2.40 2.50 2.60 2.70 2.80 2.90 3.00 3.25 3.50 3.70 4.00 4.30 4.50 Werkstoff All 1.1200 Sorte C 1.4310 nichtrostend
 <input type="submit" name="submit" value="submit">
<?php $db_con = mysql_connect('localhost', 'root', ''); if (!$db_con) { die('Could not connect: ' . mysql_error()); } mysql_select_db('feder', $db_con); if(isset($_POST['submit'])) { $duzina = mysql_real_escape_string($_POST['duzina']); $parametard = mysql_real_escape_string($_POST['parametard']); $parametarlo = mysql_real_escape_string($_POST['parametarlo']); $parametarrdj = mysql_real_escape_string($_POST['parametarrdj']); $sql = sprintf("SELECT * FROM druckfederi WHERE De= '$duzina' "); $sql .= " OR d = '$parametard'"; $sql .= " OR Lo = '$parametarlo'"; $sql .= " OR rdj = '$parametarrdj' ORDER BY d";

$result = mysql_query($sql);
echo "

















";
while($row = mysql_fetch_array($result))
{
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo ‘’;
echo “”;
}
echo “
Item d De Lo R nt Ln sn Fn Werkstoff ab Lager Price Art.-Nr. Shop
”. $row[‘Art’]. “”. $row[‘d’]. “”. $row[‘De’]. “”. $row[‘Lo’]. “”. $row[‘R’]. “”. $row[‘nt’]. “”. $row[‘Ln’]. “”. $row[‘sn’]. “”. $row[‘Fn’]. “”. $row[‘rdj’]. “”. $row[‘stanje’]. “”. $row[‘cena’]. “”. $row[‘artnr’]. “<input type=“image” src=“shopping-cart-icon-614x460.png” width=“15” height=“15”
”;
}

else

{
$sql = sprintf(“SELECT * FROM druckfederi ORDER BY d”);
$result = mysql_query($sql);
echo "

















";
while($row = mysql_fetch_array($result))
{
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo ‘’;
echo “”;
}
echo “
Item d De Lo R nt Ln sn Fn Werkstoff ab Lager Price Art.-Nr. Shop
”. $row[‘Art’]. “”. $row[‘d’]. “”. $row[‘De’]. “”. $row[‘Lo’]. “”. $row[‘R’]. “”. $row[‘nt’]. “”. $row[‘Ln’]. “”. $row[‘sn’]. “”. $row[‘Fn’]. “”. $row[‘rdj’]. “”. $row[‘stanje’]. “”. $row[‘cena’]. “”. $row[‘artnr’]. “<input type=“image” src=“shopping-cart-icon-614x460.png” width=“15” height=“15”
”;
}
mysql_close($db_con);
?>[/php]

is ti pasable that no one have answer for this ? is this to complicate or ?

You should spesify what you need help with, as it stands it looks like you just want someone to implement some functionality for you. If that’s what you’re after then a coder-for-rent service is probably more appropriate.

I would suggest cleaning up the code from the OP (remove css, etc which is not needed and just clutters it up / makes it unreadable). Then adding whatever code you are working on, and explaining spesifically what you need help with :slight_smile:

big thx Jim for your replay on this !

well i am sorry if no one understand me , i just need to make a shoping cart for this,
i make a script that show items from SQL db and that is script that i show here … there i need to put a button (add co cart ) so when someone click on that transfer that row ( that item that hi want to bay ) to shoping cart … i will send you picture and shopinf cart script that i download from web there prabebly need some modification so that can work but i dont know how to get that working

[php]<?php
include(“includes/db.php”);
include(“includes/functions.php”);

if($_REQUEST['command']=='delete' && $_REQUEST['pid']>0){
	remove_product($_REQUEST['pid']);
}
else if($_REQUEST['command']=='clear'){
	unset($_SESSION['cart']);
}
else if($_REQUEST['command']=='update'){
	$max=count($_SESSION['cart']);
	for($i=0;$i<$max;$i++){
		$pid=$_SESSION['cart'][$i]['productid'];
		$q=intval($_REQUEST['product'.$pid]);
		if($q>0 && $q<=999){
			$_SESSION['cart'][$i]['qty']=$q;
		}
		else{
			$msg='Some proudcts not updated!, quantity must be a number between 1 and 999';
		}
	}
}

?>

Shopping Cart

Your Shopping Cart

<?php echo $msg?>
<?php if(is_array($_SESSION['cart'])){ echo ''; $max=count($_SESSION['cart']); for($i=0;$i<$max;$i++){ $pid=$_SESSION['cart'][$i]['productid']; $q=$_SESSION['cart'][$i]['qty']; $pname=get_product_name($pid); if($q==0) continue; ?> <?php } ?> <?php } else{ echo ""; } ?>
Serial Name Price Qty Amount Options
<?php echo $i+1?> <?php echo $pname?> $ <?php echo get_price($pid)?> $ <?php echo get_price($pid)*$q?> Remove
Order Total: $<?php echo get_order_total()?>
There are no items in your shopping cart!
[/php]

if someone know how to get that working ! big thx


Sponsor our Newsletter | Privacy Policy | Terms of Service