Page 1 of 1

Array problem....

Posted: Tue Aug 24, 2010 3:53 pm
by SlyCayer
Hi,

Here is the following coding I am having problems with.

Code: Select all

<?php echo $product['similar1']; ?>
$product array is the following.

Code: Select all

<?php $product = array('Brand' => 'Makita', 'id' => '1','cat' => '48','SKU' => 'LXT211','Title' => '18V LXT Lithium-Ion 2-Pc. Combo Kit','Condition' => 'New','Availability' => 'In Stock, Pay today, ships today.','Picturelink' => 'http://www.jccayer.com/productphoto/400X400/LXT211.jpg','thumbpicture' => 'http://www.jccayer.com/productphoto/100X100/LXT211.jpg','Price' => '389.00','Weight' => '18','Length' => '16','Width' => '16','Height' => '6','Originalprice' => '469.00','features1' => 'LXT Lithium-Ion battery and optimum charging system produces 430% total lifetime work with 2.5x more cycles.                                                                    ','features2' => '2-Speed ½" Hammer Driver-Drill (0-400 / 0-1,500 RPM) with Makita-built 4-pole motor delivers 450 in.lbs. of torque and weighs only 4.2 lbs.','features3' => 'Variable speed Impact Driver (0-2,300 RPM) provides 1,330 in.lbs. of torque in a compact design and weighs only 3.4 lbs.','features4' => 'Makita Lithium-Ion provides longer run time, 5x lower self-discharge (for use any time) & 16 firm holding contact terminals (for constant high power).','features5' => '30-Minute Rapid Optimum Charger communicates with the battery\'s built-in chip throughout the charging process to optimize battery life by actively controlling current, voltage and temperature.','features6' => '30-Minute Rapid Optimum Charger has a built-in fan to cool the battery to produce more lifetime work.','features7' => '3-year warranty on tool and 1-year warranty on battery and charger.','features8' => '','features9' => '','features10' => '','features11' => '','features12' => '','features13' => '','features14' => '','features15' => '','features16' => '','features17' => '','features18' => '','features19' => '','features20' => '','features21' => '','features22' => '','features23' => '','features24' => '','features25' => '','features26' => '','features27' => '','features28' => '','features29' => '','features30' => '','features31' => '','features32' => '','features33' => '','features34' => '','features35' => '','features36' => '','features37' => '','features38' => '','features39' => '','features40' => '','specs1' => 'BHP452Z Specifications','specs1to' => '.','specs2' => 'Capacity','specs2to' => '.','specs3' => 'Steel','specs3to' => '1/2"','specs4' => 'Wood','specs42' => '1-1/2"','specs5' => 'Masonry','specs52' => '1/2"','specs6' => 'No Load RPM ','specs62' => '.','specs7' => 'Low','specs72' => '0-400','specs8' => 'High','specs82' => '0-1,500','specs9' => 'Blows/Min.(BPM)','specs92' => '.','specs10' => 'Low','specs102' => '0-6,000','specs11' => 'High','specs112' => '0-22,500','specs12' => 'Max Torque (in.-lbs.)','specs122' => '450','specs13' => 'Watt Hours','specs132' => '54.0','specs14' => 'Battery Type(accepts)','specs142' => '3.0Ah and 1.5Ah','specs15' => 'Length','specs152' => '8-3/4"','specs16' => 'Net Weight (lbs. w/battery)','specs162' => '4.2','specs17' => 'BTD141Z Specifications ','specs172' => '.','specs18' => 'Capacity','specs182' => '.','specs19' => 'Hex Shank','specs192' => '1/4','specs20' => 'No Load RPM','specs202' => '0-2,300','specs21' => 'Impacts/Min.(IPM)','specs212' => '0-3,200','specs22' => 'Torque (in.-lbs.)','specs222' => '1,330','specs23' => 'Watt Hours','specs232' => '54.0','specs24' => 'Battery Type(accepts)','specs242' => '3.0Ah and 1.5Ah','specs25' => 'Length','specs252' => '5-3/4"','specs26' => 'Net Weight (lbs. w/battery)','specs262' => '3.4','specs27' => 'LXT211 Specifications','specs272' => '.','specs28' => 'Shipping Weight (lbs.)','specs282' => '16.50','specs29' => '','specs292' => '','specs30' => '','specs302' => '','specs31' => '','specs312' => '','specs32' => '','specs322' => '','specs33' => '','specs332' => '','specs34' => '','specs342' => '','specs35' => '','specs352' => '','specs36' => '','specs362' => '','specs37' => '','specs372' => '','specs38' => '','specs382' => '','specs39' => '','specs392' => '','specs40' => '','specs402' => '','includes1' => '1 X BHP452Z Hammer Drill','includes2' => '1 X BTD141Z Impact Driver','includes3' => '1 X DC18RA Rapid Charger','includes4' => '2 X BL1830 18V LXT 3.0aH Battery','includes5' => '1 X Contractor bag (831284-7)','includes6' => '','includes7' => '','includes8' => '','includes9' => '','includes10' => '','includes11' => '','includes12' => '','includes13' => '','includes14' => '','includes15' => '','includes16' => '','includes17' => '','includes18' => '','includes19' => '','includes20' => '','includes21' => '','includes22' => '','includes23' => '','includes24' => '','includes25' => '','includes26' => '','includes27' => '','includes28' => '','includes29' => '','includes30' => '','includes31' => '','includes32' => '','includes33' => '','includes34' => '','includes35' => '','includes36' => '','includes37' => '','includes38' => '','includes39' => '','includes40' => '','extrapic1' => 'http://www.jccayer.com/productphoto/LXT211.jpg','extrapic2' => '','extrapic3' => '','extrapic4' => '','extrapic5' => '','extrapic6' => '','extrapic7' => '','extrapic8' => '','extrapic9' => '','extrapic10' => '','extrapic11' => '','extrapic12' => '','extrapic13' => '','extrapic14' => '','extrapic15' => '','extrapic16' => '','extrapic17' => '','extrapic18' => '','extrapic19' => '','extrapic20' => '','extrapic21' => '','extrapic22' => '','extrapic23' => '','extrapic24' => '','extrapic25' => '','extrapic26' => '','extrapic27' => '','extrapic28' => '','extrapic29' => '','extrapic30' => '','extrapic31' => '','extrapic32' => '','extrapic33' => '','extrapic34' => '','extrapic35' => '','extrapic36' => '','extrapic37' => '','extrapic38' => '','extrapic39' => '','extrapic40' => '','extrapicthumb1' => 'http://www.jccayer.com/productphoto/90X68/LXT211.jpg','extrapicthumb2' => '','extrapicthumb3' => '','extrapicthumb4' => '','extrapicthumb5' => '','extrapicthumb6' => '','extrapicthumb7' => '','extrapicthumb8' => '','extrapicthumb9' => '','extrapicthumb10' => '','extrapicthumb11' => '','extrapicthumb12' => '','extrapicthumb13' => '','extrapicthumb14' => '','extrapicthumb15' => '','extrapicthumb16' => '','extrapicthumb17' => '','extrapicthumb18' => '','extrapicthumb19' => '','extrapicthumb20' => '','extrapicthumb21' => '','extrapicthumb22' => '','extrapicthumb23' => '','extrapicthumb24' => '','extrapicthumb25' => '','extrapicthumb26' => '','extrapicthumb27' => '','extrapicthumb28' => '','extrapicthumb29' => '','extrapicthumb30' => '','extrapicthumb31' => '','extrapicthumb32' => '','extrapicthumb33' => '','extrapicthumb34' => '','extrapicthumb35' => '','extrapicthumb36' => '','extrapicthumb37' => '','extrapicthumb38' => '','extrapicthumb39' => '','extrapicthumb40' => '','pricingtype' => 'list','enddate' => '12/31/2010','pricingtype' => 'list','enddate' => '12/31/2010','similar1' => '369','similar2' => '276','similar3' => '294','similar4' => '277');?>
The array is a small database for a product.

When I do echo $product['similar1']; it's printing the following "1189" and not "369" like it would suppose to be.

Is this something I don't understand.

P.S: the

Code: Select all

<?php echo $product['similar2']; ?>
and

Code: Select all

<?php echo $product['similar3']; ?>
and

Code: Select all

<?php echo $product['similar4']; ?>
are working correctly, the only similar I have a problem with is the "similar1".

Re: Array problem....

Posted: Tue Aug 24, 2010 6:15 pm
by JakeJ
It worked just great for me. I got the expected results. My guess is that something is changing that value before you're echoing it out.

Re: Array problem....

Posted: Tue Aug 24, 2010 6:24 pm
by SlyCayer
Hmmmm... similar2, 3 and 4 are working awesome. But similar1 doesn't want to work. I looked with ctrl-f to find if anywhere in my source code the "similar1" was used or typed anywhere else and it wasn't.

Could it have anything to do with server or anything?

Re: Array problem....

Posted: Wed Aug 25, 2010 6:48 am
by SlyCayer
Found the problem. Thanks for the help JakeJ.