<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1041533" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1041533</link>
    <description></description>
    <language>en</language>
          <item>
    <title>OK,
But i am building the</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/function-help-looping-no-loop#comment-1231749</link>
    <description> &lt;p&gt;OK,&lt;br /&gt;
But i am building the error message and putting it in $error if $error has something in it i return false.&lt;br /&gt;
On the page that calls the method insert checks to see if it is returning false (has some errors) if it does it prints out $error.&lt;/p&gt;
&lt;p&gt;I then dont want the method Insert to run any further past the error so i exit the scipt?&lt;/p&gt;
&lt;p&gt;Is this incorrect?&lt;/p&gt;
 </description>
     <pubDate>Wed, 23 Jul 2008 09:44:02 +0000</pubDate>
 <dc:creator>benf</dc:creator>
 <guid isPermaLink="false">comment 1231749 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>The method you posted never</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/function-help-looping-no-loop#comment-1231694</link>
    <description> &lt;p&gt;The method you posted never prints anything.  It just returns an error message if something goes wrong.&lt;/p&gt;
&lt;p&gt;Also, in this code:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;error &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;!= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;return &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;FALSE&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;exit(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;} &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;exit(0); will never run because the return statement is above it, and once you return, the method is over.&lt;/p&gt;
 </description>
     <pubDate>Mon, 21 Jul 2008 13:43:59 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1231694 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I build the Error variable</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/function-help-looping-no-loop#comment-1231688</link>
    <description> &lt;p&gt;I build the Error variable and call it on the main page from $this-&amp;gt;error if the method returns false - this prints the error messages?&lt;/p&gt;
&lt;p&gt;I will have another look then.&lt;/p&gt;
 </description>
     <pubDate>Mon, 21 Jul 2008 09:04:12 +0000</pubDate>
 <dc:creator>benf</dc:creator>
 <guid isPermaLink="false">comment 1231688 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Are you sure you&#039;re not</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/function-help-looping-no-loop#comment-1231683</link>
    <description> &lt;p&gt;Are you sure you&#039;re not calling the method more than once?  I know it sounds too simple, but there is no way the code you posted would run twice unless you called the method twice.&lt;/p&gt;
&lt;p&gt;Another possibility.  I see that you append $this-&amp;gt;error, but I don&#039;t see where it is declared.  If you are saving/restoring that variable from a session, then you could be building and copying error messages as you test.&lt;/p&gt;
 </description>
     <pubDate>Mon, 21 Jul 2008 02:12:47 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1231683 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>If you read my last post</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/function-help-looping-no-loop#comment-1231682</link>
    <description> &lt;p&gt;If you read my last post before I removed what I wrote then my apologies. I re-read your code and realised what the second array you made was doing.&lt;/p&gt;
&lt;p&gt;something I noticed unrelated to the error you have an issue with..&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;foreach (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$data &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;as &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$field &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&amp;gt; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)&lt;br /&gt;&lt;br /&gt;if (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;in_array&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$field&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$data_fields&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$fields &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;.= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;`&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$field&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;`,&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$values &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;.= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;&#039;&quot; &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;. &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;mysql_real_escape_string&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;dbconnection&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;()) . &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;&#039;,&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
If the value of $field isn&#039;t in the array $data_fields, then it wont be sanitised by real_escape.&lt;br /&gt;
Perhaps some of the data in the $data array doesn&#039;t need filtering, and you have already checked the data on a previous page to ensure it&#039;s ok to enter into the db I.E. no apostrophes or quotes etc.&lt;br /&gt;
Otherwise it&#039;s a potential to NOT sanitise data that might need to be for security. &lt;/p&gt;
&lt;p&gt;As for your initial problem, within the code you provided (the function) I see no reason whatsoever why it would echo the error twice.&lt;br /&gt;
I have to go out atm, but if you or no-one else has found the error or put you on the right track I&#039;ll have another look later.&lt;/p&gt;
 </description>
     <pubDate>Sun, 20 Jul 2008 19:27:00 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1231682 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Sorry greg, im not sure i</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/function-help-looping-no-loop#comment-1231679</link>
    <description> &lt;p&gt;Sorry greg, im not sure i understand?&lt;/p&gt;
 </description>
     <pubDate>Sun, 20 Jul 2008 18:37:21 +0000</pubDate>
 <dc:creator>benf</dc:creator>
 <guid isPermaLink="false">comment 1231679 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Edited as was incorrect</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/function-help-looping-no-loop#comment-1231678</link>
    <description> &lt;p&gt;Edited as was incorrect findings&lt;/p&gt;
 </description>
     <pubDate>Sun, 20 Jul 2008 18:13:00 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1231678 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Yes this is what i did:
in</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/function-help-looping-no-loop#comment-1231677</link>
    <description> &lt;p&gt;Yes this is what i did:&lt;/p&gt;
&lt;p&gt;in place of the below&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($this-&amp;gt;error != &amp;quot;&amp;quot;){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return FALSE;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit(0);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;i changed to this:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($this-&amp;gt;error != &amp;quot;&amp;quot;){&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $this-&amp;gt;error .=$i++;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return FALSE;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit(0);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;i being declared at the top of my script as 0.  The result appended 0 then 1 to the end of each set of errors - for example&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;please enter an email address&lt;br /&gt;
please confirm your password&lt;br /&gt;
0&lt;/p&gt;
&lt;p&gt;please enter an email address&lt;br /&gt;
please confirm your password&lt;br /&gt;
1&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;the example above you can see 0 then 1.&lt;br /&gt;
I have exited the script so really nothing below it should be executing, and above there is no loop?&lt;/p&gt;
 </description>
     <pubDate>Sun, 20 Jul 2008 17:42:57 +0000</pubDate>
 <dc:creator>benf</dc:creator>
 <guid isPermaLink="false">comment 1231677 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>troubleshoot the flow
add</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/function-help-looping-no-loop#comment-1231674</link>
    <description> &lt;p&gt;troubleshoot the flow&lt;/p&gt;
&lt;p&gt;add &lt;code&gt;echo &amp;quot;step1 &amp;quot;;&lt;/code&gt; and &lt;code&gt;echo &amp;quot;step2 &amp;quot;;&lt;/code&gt; etc.&lt;/p&gt;
&lt;p&gt;or &lt;code&gt;echo &amp;quot;&amp;lt;script&amp;gt;alert(&amp;#039;step1&amp;#039;)&amp;lt;/script&amp;gt;&amp;quot;;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;to see where it breaks down - you could also add variables if that helps...&lt;/p&gt;
 </description>
     <pubDate>Sun, 20 Jul 2008 16:59:11 +0000</pubDate>
 <dc:creator>decibel.places</dc:creator>
 <guid isPermaLink="false">comment 1231674 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Hi thanks for the quick</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/function-help-looping-no-loop#comment-1231673</link>
    <description> &lt;p&gt;Hi thanks for the quick reply.&lt;/p&gt;
&lt;p&gt;I dont think i have been clear enough. Not a php error;my own error detection - ie...email address not filled in, passwords do not match.&lt;/p&gt;
&lt;p&gt;If you look i check to see if the variable error has anything in it, if it does then i return false and exit().&lt;/p&gt;
&lt;p&gt;Trouble is that what ever errors i pick up are printed twice?&lt;/p&gt;
 </description>
     <pubDate>Sun, 20 Jul 2008 16:41:47 +0000</pubDate>
 <dc:creator>benf</dc:creator>
 <guid isPermaLink="false">comment 1231673 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
