LynnStrauch Posted July 5, 2009 Report Share Posted July 5, 2009 (edited) Hi, I am following along, and doing well for the most part until I hit the Array tutorial #2. Here is what I have, and I blows an error on line 17 everytime. I am getting kind of frustrated because it looks right, yet, it must not be. What am I doing wrong. It is in the "first line of the actual array. <?php //Associative Arrays $prices_array = array("TV" => "250.00", "DVD" => "100.00", "VHS" => "2.00",); print $prices_array ['TV']; ?> Thank you, Lynn Edited July 5, 2009 by LynnStrauch Quote Link to comment Share on other sites More sharing options...
jlhaslip Posted July 5, 2009 Report Share Posted July 5, 2009 the code snippet works perfectly for me. is there more code? Quote Link to comment Share on other sites More sharing options...
LynnStrauch Posted July 5, 2009 Author Report Share Posted July 5, 2009 (edited) <?php //Associative Arrays $my_array = array("Elizabeth","Lynn","Lynette",7); print "The value held in position 2: "; print $my_array [2]; // Associatative Array Uses Name Value Pairs print " " $prices_array = array("TV" => "250.00", "DVD" => "100.00", "VHS" => "2.00", ); print $prices_array ['TV']; ?> Edited July 5, 2009 by LynnStrauch Quote Link to comment Share on other sites More sharing options...
Korken Posted July 6, 2009 Report Share Posted July 6, 2009 Hmm, it sems the array is a bit wrong; $prices_array = array("TV" => "250.00", "DVD" => "100.00", "VHS" => "2.00", ); Should be (notice the last ", " i removed): $prices_array = array("TV" => "250.00", "DVD" => "100.00", "VHS" => "2.00"); //Emil Fresk Sweden Quote Link to comment Share on other sites More sharing options...
LynnStrauch Posted July 6, 2009 Author Report Share Posted July 6, 2009 (edited) Well, that did not work either. I am still getting the error after removing the comma and space. Stephan has it working with the comma and space...room for another I am assuming, and it works for him, and it is working for the other guy...but not for me...sigh. Same Error though: Parse error: parse error in C:\wamp\www\php_work\AssociativeArray.php on line 19 Lynn Edited July 6, 2009 by LynnStrauch Quote Link to comment Share on other sites More sharing options...
jlhaslip Posted July 6, 2009 Report Share Posted July 6, 2009 Add the line ending semi-colon on the line above the array declaration. // Associatative Array Uses Name Value Pairs print " "; Quote Link to comment Share on other sites More sharing options...
LynnStrauch Posted July 6, 2009 Author Report Share Posted July 6, 2009 That worked!!! Thank you! These tutorials are awesome, and so is this board! Thanks to everyone, especially Stephan. Lynn Strauch Quote Link to comment 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.
Note: Your post will require moderator approval before it will be visible.