Kitsun3 Posted October 27, 2011 Share Posted October 27, 2011 [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 More sharing options...
The Little Guy Posted October 27, 2011 Share Posted October 27, 2011 you are probably missing a "}" please don't copy and paste your whole code next time. No one wants to look through 300 lines of code to find line 178. Link to comment https://forums.phpfreaks.com/topic/249909-syntax-error/#findComment-1282681 Share on other sites More sharing options...
Kitsun3 Posted October 27, 2011 Author Share Posted October 27, 2011 Ok, I found the missing bracket and replaced it... ...and it works now, thanks. My bad, I thought I had counted the brackets beforehand. Link to comment https://forums.phpfreaks.com/topic/249909-syntax-error/#findComment-1282684 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.