 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Parsing error: Declare and initialize an associative array</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/parsing-error-declare-and-initialize-an-associative-array/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/parsing-error-declare-and-initialize-an-associative-array/</link>
	<description></description>
	<lastBuildDate>Sun, 19 May 2013 03:14:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: myittrouble</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/parsing-error-declare-and-initialize-an-associative-array/#comment-79122</link>
		<dc:creator>myittrouble</dc:creator>
		<pubDate>Tue, 13 Jul 2010 05:43:12 +0000</pubDate>
		<guid isPermaLink="false">#comment-79122</guid>
		<description><![CDATA[Pat,

Did you ever get the code figured out for this? I have been working my tail off and other than the advice from a few student who pay to get a professional coder to do theirs I am no closer to finishing mine. Is there any chance you have your Unit 4 on projects for IT250 or at least the unit 4 &amp; 5 and would either post the code or upload and post a download link? I hate to ask but I just do not know what else to do short of paying $30 bucks to have a PHP coder to do it.]]></description>
		<content:encoded><![CDATA[<p>Pat,</p>
<p>Did you ever get the code figured out for this? I have been working my tail off and other than the advice from a few student who pay to get a professional coder to do theirs I am no closer to finishing mine. Is there any chance you have your Unit 4 on projects for IT250 or at least the unit 4 &amp; 5 and would either post the code or upload and post a download link? I hate to ask but I just do not know what else to do short of paying $30 bucks to have a PHP coder to do it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kapone1</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/parsing-error-declare-and-initialize-an-associative-array/#comment-78968</link>
		<dc:creator>kapone1</dc:creator>
		<pubDate>Thu, 08 Jul 2010 03:51:49 +0000</pubDate>
		<guid isPermaLink="false">#comment-78968</guid>
		<description><![CDATA[I am on same one now as well and yes it is a KILLER!!]]></description>
		<content:encoded><![CDATA[<p>I am on same one now as well and yes it is a KILLER!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: myittrouble</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/parsing-error-declare-and-initialize-an-associative-array/#comment-78902</link>
		<dc:creator>myittrouble</dc:creator>
		<pubDate>Tue, 06 Jul 2010 09:58:51 +0000</pubDate>
		<guid isPermaLink="false">#comment-78902</guid>
		<description><![CDATA[I am doing the same project now and I am stuck on it as well. I hate that, I hope you got yours figured out better than I have. Wished I had thought sooner to ask a tech help person.]]></description>
		<content:encoded><![CDATA[<p>I am doing the same project now and I am stuck on it as well. I hate that, I hope you got yours figured out better than I have. Wished I had thought sooner to ask a tech help person.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/parsing-error-declare-and-initialize-an-associative-array/#comment-74979</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Thu, 18 Mar 2010 13:48:44 +0000</pubDate>
		<guid isPermaLink="false">#comment-74979</guid>
		<description><![CDATA[I&#039;m sure you will.

Take a look at this:

&lt;a href=&quot;http://www.devarticles.com/c/a/PHP/Working-With-Text-Files-in-PHP/1/&quot;&gt;Working With Text Files in PHP&lt;/a&gt;]]></description>
		<content:encoded><![CDATA[<p>I&#8217;m sure you will.</p>
<p>Take a look at this:</p>
<p><a href="http://www.devarticles.com/c/a/PHP/Working-With-Text-Files-in-PHP/1/">Working With Text Files in PHP</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: patoswalt</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/parsing-error-declare-and-initialize-an-associative-array/#comment-74962</link>
		<dc:creator>patoswalt</dc:creator>
		<pubDate>Thu, 18 Mar 2010 01:12:04 +0000</pubDate>
		<guid isPermaLink="false">#comment-74962</guid>
		<description><![CDATA[Okay.  Thank you.  You gave me another way to look at it.  I think I can figure this out.  Hopefully, I&#039;ll be able to pay this forward some day.
Patricia]]></description>
		<content:encoded><![CDATA[<p>Okay.  Thank you.  You gave me another way to look at it.  I think I can figure this out.  Hopefully, I&#8217;ll be able to pay this forward some day.<br />
Patricia</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/parsing-error-declare-and-initialize-an-associative-array/#comment-74959</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Wed, 17 Mar 2010 22:47:05 +0000</pubDate>
		<guid isPermaLink="false">#comment-74959</guid>
		<description><![CDATA[Hi Patricia,

First of all, I must say that I&#039;m not a PHP expert.  My PHP knowledge is very limited, but similar concepts apply to different languages, so...

Regarding this:

&quot;&lt;i&gt;...But if I’m trying to pull the information from a text file, wouldn’t the variables be defined once I opened the text file for reading?&lt;/i&gt;&quot;

No, you used those variables to write to the file, but that information (variable names) is not stored in the file.  The file contains just plain text, so you will have read the text, parse it, and assign the appropriate values to your variables.]]></description>
		<content:encoded><![CDATA[<p>Hi Patricia,</p>
<p>First of all, I must say that I&#8217;m not a PHP expert.  My PHP knowledge is very limited, but similar concepts apply to different languages, so&#8230;</p>
<p>Regarding this:</p>
<p>&#8220;<i>&#8230;But if I’m trying to pull the information from a text file, wouldn’t the variables be defined once I opened the text file for reading?</i>&#8221;</p>
<p>No, you used those variables to write to the file, but that information (variable names) is not stored in the file.  The file contains just plain text, so you will have read the text, parse it, and assign the appropriate values to your variables.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: patoswalt</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/parsing-error-declare-and-initialize-an-associative-array/#comment-74958</link>
		<dc:creator>patoswalt</dc:creator>
		<pubDate>Wed, 17 Mar 2010 22:07:02 +0000</pubDate>
		<guid isPermaLink="false">#comment-74958</guid>
		<description><![CDATA[Okay, I&#039;m going to go back to my PHP book to read up about scopes again.  But if I&#039;m trying to pull the information from a text file, wouldn&#039;t the variables be defined once I opened the text file for reading?

&lt;pre&gt;
	$fp = fopen(&#039;contactlist.txt&#039;, &#039;r+&#039;);
	if(!$fp) die (&quot;Cannot open the file&quot;);
&lt;/pre&gt;

And if not, would I declare them in the same manner as I did in the initial php file that created the text file?

Just in case we need clarification:
There&#039;s an&lt;b&gt; InputTelephone.html &lt;/b&gt;form for the user to fill out, then a &lt;b&gt;SaveDirectory.php&lt;/b&gt; file to save the data to the &lt;b&gt;contactlist.txt&lt;/b&gt;.  Lastly, there&#039;s the &lt;b&gt;DisplayDirectory.php&lt;/b&gt; that I&#039;m trying to figure out.

I really appreciate the time you&#039;re giving me to help me figure this out.  Would it be easier if I zipped the files and sent them to you?  Whatever would be easier for you.

Patricia]]></description>
		<content:encoded><![CDATA[<p>Okay, I&#8217;m going to go back to my PHP book to read up about scopes again.  But if I&#8217;m trying to pull the information from a text file, wouldn&#8217;t the variables be defined once I opened the text file for reading?</p>
<pre>
	$fp = fopen('contactlist.txt', 'r+');
	if(!$fp) die ("Cannot open the file");
</pre>
<p>And if not, would I declare them in the same manner as I did in the initial php file that created the text file?</p>
<p>Just in case we need clarification:<br />
There&#8217;s an<b> InputTelephone.html </b>form for the user to fill out, then a <b>SaveDirectory.php</b> file to save the data to the <b>contactlist.txt</b>.  Lastly, there&#8217;s the <b>DisplayDirectory.php</b> that I&#8217;m trying to figure out.</p>
<p>I really appreciate the time you&#8217;re giving me to help me figure this out.  Would it be easier if I zipped the files and sent them to you?  Whatever would be easier for you.</p>
<p>Patricia</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/parsing-error-declare-and-initialize-an-associative-array/#comment-74957</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Wed, 17 Mar 2010 21:25:12 +0000</pubDate>
		<guid isPermaLink="false">#comment-74957</guid>
		<description><![CDATA[In PHP, variables are created when you assign them a value for the first time.  As the error messages say, the variables you are using are undefined (they don&#039;t exist in that scope).]]></description>
		<content:encoded><![CDATA[<p>In PHP, variables are created when you assign them a value for the first time.  As the error messages say, the variables you are using are undefined (they don&#8217;t exist in that scope).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: patoswalt</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/parsing-error-declare-and-initialize-an-associative-array/#comment-74956</link>
		<dc:creator>patoswalt</dc:creator>
		<pubDate>Wed, 17 Mar 2010 20:42:48 +0000</pubDate>
		<guid isPermaLink="false">#comment-74956</guid>
		<description><![CDATA[Using the first suggestion:
&lt;pre&gt;
	$Listing = array();
	$Listing[$Name] = $LastName.&quot;,&quot;. $FirstName;
	$Listing[$Number] = $PhoneNum;
&lt;/pre&gt;
I received the following error:

Notice: Undefined variable: LastName in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php  on line 21

Notice: Undefined variable: FirstName in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php on line 21

Notice: Undefined variable: Name in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php on line 21

Notice: Undefined variable: Number in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php on line 22

Notice: Undefined variable: PhoneNum in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php on line 22

Using your second suggestion:
&lt;pre&gt;
	$Listing = array();
	$Listing[$LastName.&quot;,&quot;. $FirstName] = $PhoneNum;
&lt;/pre&gt;

I received this error
Notice: Undefined variable: LastName in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php  on line 21

Notice: Undefined variable: FirstName in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php on line 21

Notice: Undefined variable: PhoneNum in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php on line 21

Name	Phone Number
,	

Add New Listing

Retrieve Contact List

Thank you so much for the help.  Patricia]]></description>
		<content:encoded><![CDATA[<p>Using the first suggestion:</p>
<pre>
	$Listing = array();
	$Listing[$Name] = $LastName.",". $FirstName;
	$Listing[$Number] = $PhoneNum;
</pre>
<p>I received the following error:</p>
<p>Notice: Undefined variable: LastName in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php  on line 21</p>
<p>Notice: Undefined variable: FirstName in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php on line 21</p>
<p>Notice: Undefined variable: Name in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php on line 21</p>
<p>Notice: Undefined variable: Number in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php on line 22</p>
<p>Notice: Undefined variable: PhoneNum in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php on line 22</p>
<p>Using your second suggestion:</p>
<pre>
	$Listing = array();
	$Listing[$LastName.",". $FirstName] = $PhoneNum;
</pre>
<p>I received this error<br />
Notice: Undefined variable: LastName in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php  on line 21</p>
<p>Notice: Undefined variable: FirstName in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php on line 21</p>
<p>Notice: Undefined variable: PhoneNum in C:wampwwwOswaltPatricia_Unit5AssignmentDisplayDirectory.php on line 21</p>
<p>Name	Phone Number<br />
,	</p>
<p>Add New Listing</p>
<p>Retrieve Contact List</p>
<p>Thank you so much for the help.  Patricia</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/parsing-error-declare-and-initialize-an-associative-array/#comment-74941</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Wed, 17 Mar 2010 15:01:21 +0000</pubDate>
		<guid isPermaLink="false">#comment-74941</guid>
		<description><![CDATA[Sorry.  Had to edit the answer many times as some code was not showing properly.]]></description>
		<content:encoded><![CDATA[<p>Sorry.  Had to edit the answer many times as some code was not showing properly.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 5/8 queries in 0.026 seconds using memcached
Object Caching 395/396 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-19 14:28:52 -->