![]() |
Codeigniter Cart Insert Error.. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Codeigniter Cart Insert Error.. (/showthread.php?tid=60499) |
Codeigniter Cart Insert Error.. - El Forum - 04-09-2014 [eluser]ginteno[/eluser] Hi can somebody tell me what's wrong with my cart insert code.. adding item to cart works perfect using localhost xampp but when i uploaded it online on my hosting. the adding item cart part is showing errors.. Here is the Code Code: public function insert_cart(){ ERROR MESSAGE A PHP Error was encountered Severity: Warning Message: implode() [function.implode]: Invalid arguments passed Filename: libraries/Cart.php Line Number: 220 A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at /home2/wusignco/public_html/nunez/system/core/Exceptions.php:185) Filename: libraries/Session.php Line Number: 675 A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at /home2/wusignco/public_html/nunez/system/core/Exceptions.php:185) Filename: helpers/url_helper.php Line Number: 542 ERROR LOG FILE [08-Apr-2014 17:26:50] PHP Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home2/wusignco/public_html/nunez/application/controllers/cart.php on line 41 [08-Apr-2014 17:26:52] PHP Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home2/wusignco/public_html/nunez/application/controllers/cart.php on line 41 [08-Apr-2014 18:07:44] PHP Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /home2/wusignco/public_html/nunez/application/controllers/cart.php on line 122 [08-Apr-2014 18:07:44] PHP Parse error: syntax error, unexpected $end in /home2/wusignco/public_html/nunez/application/controllers/cart.php on line 122 [08-Apr-2014 18:09:01] PHP Parse error: syntax error, unexpected $end in /home2/wusignco/public_html/nunez/application/controllers/cart.php on line 65 [08-Apr-2014 18:09:23] PHP Parse error: syntax error, unexpected $end in /home2/wusignco/public_html/nunez/application/controllers/cart.php on line 171 [08-Apr-2014 18:11:36] PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home2/wusignco/public_html/nunez/application/controllers/cart.php on line 40 [08-Apr-2014 18:11:38] PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home2/wusignco/public_html/nunez/application/controllers/cart.php on line 40 Any help would be appreciated.. Thanks.. Codeigniter Cart Insert Error.. - El Forum - 04-09-2014 [eluser]InsiteFX[/eluser] And what is the code that's on line 40 in cart.php? Codeigniter Cart Insert Error.. - El Forum - 04-09-2014 [eluser]ginteno[/eluser] 34 public function insert_cart(){ 35 36 $data = array( 37 'id' => 11, 38 'qty' => 1, 39 'price' => 500, 40 'name' => 'new_product', 41 'options' => 888 42 ); 43 44 print_r($data); 45 46 $this->cart->insert($data); 47 48 } As i debug it the name or options part causes error... i tried different string and integer to check the error but still no luck.. Codeigniter Cart Insert Error.. - El Forum - 04-09-2014 [eluser]Tpojka[/eluser] Probably irrelevant, but why is one blank space infront 'new_product'? Codeigniter Cart Insert Error.. - El Forum - 04-09-2014 [eluser]ginteno[/eluser] i tried with or without underscore in the name but still same error.. it's 100% percent working on localhost.. i don't know why it's having error on my hosting.. do i have to set some config setting or what?? Codeigniter Cart Insert Error.. - El Forum - 04-09-2014 [eluser]InsiteFX[/eluser] Try putting a comma after the 888 Codeigniter Cart Insert Error.. - El Forum - 04-09-2014 [eluser]ginteno[/eluser] I already did that.. still no luck.. Codeigniter Cart Insert Error.. - El Forum - 04-16-2014 [eluser]Tim Brownlaw[/eluser] The options needs to be an array... As stated in the users Guide... $data = array( 'id' => 'sku_123ABC', 'qty' => 1, 'price' => 39.95, 'name' => 'T-Shirt', 'options' => array('Size' => 'L', 'Color' => 'Red') ); Line 220 in cart.php is trying to perform an implode on a number... In your case 888 and that is why it is erroring... So change your options to an array and see what happens. The ID might also have to be a string and not an integer - it specifies it can be alpha-numeric which suggests it needs to have quotes to make it a string and not an integer. See how that flies for you! Cheers Tim |