TottoBennington Posted February 21, 2012 Share Posted February 21, 2012 Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' <?php function paypal_items() { $num = 0; foreach($_SESSION as $name => $value){ if($value != 0){ if (substr($name, 0, 5) == 'cart_') { $id = substr($name, 5, strlen($name) -5); $get = mysql_query('SELECT id, name, price, shipping FROM products WHERE id='.mysql_real_escape_string((int)$id)); while ($get_row = mysql_fetch_assoc($get)) { $num++; echo '<input type="hidden" name="item_number_'.$num'" value="'.$id.'" />'; echo '<input type="hidden" name="item_name_'.$num.'" value="'.$get_row['name'].'" />'; echo '<input type="hidden" name="amount_'.$num.'" value="'.$get_row['price'].'" />'; echo '<input type="hidden" name="shipping_'.$num.'" value="'.$get_row['shipping'].'" />'; echo '<input type="hidden" name="shipping2_'.$num.'" value="'.$get_row['shipping'].'" />'; echo '<input type="hidden" name="quantity_'.$num.'" value="'.$get_row['quantity'].'" />'; } } } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/257426-php-syntax-error-can-you-help-me/ Share on other sites More sharing options...
jcbones Posted February 21, 2012 Share Posted February 21, 2012 Giving a line number will speed up answers. Just a heads up. Here lies the problem. echo '<input type="hidden" name="item_number_'.$num'" value="'.$id.'" />'; //You have missed a period (.)(dot) after $num. Quote Link to comment https://forums.phpfreaks.com/topic/257426-php-syntax-error-can-you-help-me/#findComment-1319400 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.