Jump to content

Syntax Error


Kitsun3

Recommended Posts

[code    	<?
		if(is_array($_SESSION['cart'])){
            	echo '<tr bgcolor="#003366" style="font-weight:bold; color: #FFF;"><td class="carthead">Name</td><td class="carthead">Price</td><td class="carthead">Qty</td><td class="carthead">Amount</td><td class="carthead">Options</td></tr>';
			$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);
				$sku=get_sku($pid);
				if($q==0) continue;

				mysql_connect ('localhost', 'something', 'somepass') ;
				mysql_select_db ('somedata_merch');

				$sql1 = "SELECT * FROM items WHERE sku='$sku' ";

				$result1 = mysql_query($sql1) or print ("Can't select entries from table.<br />" . $sql1 . mysql_error());

				while($row1 = mysql_fetch_array($result1)) {

					$color1  = stripslashes($row1['color1']);
					$color2  = stripslashes($row1['color2']);
					$color3  = stripslashes($row1['color3']);
					$color4  = stripslashes($row1['color4']);

		?>
            		<tr bgcolor="#FFFFFF">
                    <td class="cart" width="250px"><?=$pname?></td>
                    <td class="cart" width="100px">$ <?=get_price($pid)?></td>
                    <td class="cart" width="60px"><input type="text" name="product<?=$pid?>" value="<?=$q?>" maxlength="3" size="2" /></td>               
                    <td class="cart" width="100px">$ <?=get_price($pid)*$q?></td>
                    <td class="cart" width="100px">
                  <select name="jumpMenu2" id="jumpMenu2" onchange="MM_jumpMenu('parent',this,0)">
                    <option value="#"><?php echo $color; ?></option>
                    <option value="shoppingcart.php?color=<?=$color1?>"><?=$color1?></option>
                    <option value="shoppingcart.php?color=<?=$color2?>"><?=$color2?></option>
                    <option value="shoppingcart.php?color=<?=$color3?>"><?=$color3?></option>
                    <option value="shoppingcart.php?color=<?=$color4?>"><?=$color4?></option>
                  </select>
                  </td>
                    <td class="cart" width="60px" align="center">
                    <a href="javascript:del(<?=$pid?>)">
                    <img src="delete.png" width="30px" height="30px" border="0" alt="remove item" />
                    </a>
                    </td>
                    </tr>
            <?	

			}
		?>
			<tr><td><b style="margin-left: 5px;">Order Total: $<?=get_order_total()?></b></td><td colspan="5" align="right"><input type="button" value="Clear Cart" onclick="clear_cart()"><input type="button" value="Update Cart" onclick="update_cart()"><input type="button" value="Place Order" onclick="window.location='direct_post.php'"></td></tr>
		<?  }else{

			echo "<tr bgColor='#FFFFFF'><td>There are no items in your shopping cart!</td>";

		}
	?>
        

 

I am currently getting this error.

 

Parse error: syntax error, unexpected T_ELSE in /../../../shoppingcart.php on line 178.

 

Please help.

Link to comment
https://forums.phpfreaks.com/topic/249909-syntax-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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