PHP shopping cart cant understand the error -


this question has answer here:

i getting error in cart.php

parse error: syntax error, unexpected '' (t_encapsed_and_whitespace), expecting identifier (t_string) or variable (t_variable) or number (t_num_string) in cart.php on line 74

line 74

$subtotal = $_session['cart'][$row['id_number']]['quantity']*$row['price'];    <?php  if(isset($_post['submit'])) {     foreach($_post $items => $item)     {         $items = explode("-",$items);         $items = end($items);         $items = explode("submit",$items);         $items = end($items);          if($_post['quantity-'.$items]<=0)         {             unset($_session['cart'][$items]);         }          else         {             $_session['cart'][$items]['quantity']=$item;         }     } }   error_reporting(0);  ?>  <h1>view cart</h1>  <a href = "cds.php?page=products" title="go products page">go products page</a>  <?php $sql = "select * product id_number in (";     foreach($_session['cart'] $id_b00073643 => $value)     {         $sql.= $id_b00073643.",";     }          $sql= substr($sql,0,-1).") order name asc";         $query = mysql_query($sql);      if(empty($query))     {         echo"you need add item first";     } ?>      <form method = "post" action = "cds.php?page=cart">     <fieldset>                  <table border="1">                 <tr>                     <th>artist</th>                     <th>name</th>                     <th>price</th>                     <th>genre</th>                     <th>type</th>                     <th></th>                 </tr>      <?php      $sql = "select * product id_number in (";     foreach($_session['cart'] $id_b00073643 => $value)     {             $sql.= $id_b00073643.",";         }              $sql= substr($sql,0,-1).") order artist asc";             $query = mysql_query($sql);             $cost = 0;              if(!empty($query))`             {                 while($row = mysql_fetch_array($query))                 {                     $subtotal = $_session['cart'][$row['id_number']]['quantity']*$row['price'];                     $cost += subtotal;                       ?>                      <tr>                         <td><?php echo $row['name'];?></td>                         <td><input type = "text" name = "quantity"<?php echo $row['id_number'];?>"size ="5" value="<?php echo $_session['cart'][$row['id_number']]['quantity'];?>"/></td>                         <td><?php echo"$".$row['price'];?></td>                         <td><?php echo"$".$_session['cart'][$row['id_number']]['quantity']*$row['price'];?></td>                     </tr>              <?php              } }             ?>              <tr>              <td> </td>             <td></td>             <td>total price</td>             <td><?php echo"$" . $cost; ?></td>             </tr>             </table>              <input type = "submit" name = "submit" value = "update cart"/></fieldset>             </form>             <p> remove item set quantity 0</p> 

not sure no 74 line or not why using backtick (`)? make try after removing it.

on  if(!empty($query))`                      ^^  

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -