<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1032938" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1032938</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/if-var-contains-var#comment-1192850</link>
    <description> &lt;p&gt;Update!  I think I&#039;ve got it.  I think that I understand what the code in my above post does, but I think I finally figured out how to check this thing!&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// Define \&quot;page\&quot; Variable&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$page &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_GET&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;page&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$getrownums &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;mysql_query&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;SELECT * FROM pages\&quot;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$database&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Check \&quot;page\&quot; for Malicious Code&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( (isset(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$page&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;)) &amp;amp;&amp;amp; (is_numeric(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$page&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;)) &amp;amp;&amp;amp; (mysql_num_rows(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$getrownums&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;)==&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$page&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;) ){&lt;br /&gt;&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;$page&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_GET&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;page&#039;];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }else{&lt;br /&gt;&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;$page&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = \&quot;1\&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Tue, 07 Feb 2006 22:46:33 +0000</pubDate>
 <dc:creator>Dragon of Ice</dc:creator>
 <guid isPermaLink="false">comment 1192850 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/if-var-contains-var#comment-1192849</link>
    <description> &lt;p&gt;I&#039;ll just play with the code to see, but my exact question is:&lt;/p&gt;
&lt;p&gt;mysql_num_rows($getPage)&amp;gt;0&lt;/p&gt;
&lt;p&gt;Is this checking if the number of rows in the table is greater than zero?  If not, what is it checking?&lt;/p&gt;
 </description>
     <pubDate>Tue, 07 Feb 2006 22:38:31 +0000</pubDate>
 <dc:creator>Dragon of Ice</dc:creator>
 <guid isPermaLink="false">comment 1192849 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/if-var-contains-var#comment-1192774</link>
    <description> &lt;p&gt;&lt;strong&gt;$getPage=mysql_query(&quot;SELECT * FROM table WHERE id = {$_GET[&#039;id&#039;]} LIMIT 1&quot;);&lt;/strong&gt;&lt;br /&gt;
$getPage contains the result of the database query (table is the database tables name), Limit 1 just gets one result as there should only be one.&lt;br /&gt;
The $_GET[&#039;id&#039;] is the value passed in the URL: webpage.com?id=1234, this is checked for in the mysql_query&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;if(mysql_num_rows($getPage)&amp;gt;0){&lt;/strong&gt;&lt;br /&gt;
if the results is true - found a match&lt;br /&gt;
&lt;strong&gt;$page=$_GET[&#039;page&#039;];&lt;/strong&gt;&lt;br /&gt;
display whatever is related or whatever you do&lt;br /&gt;
&lt;strong&gt;}else{&lt;br /&gt;
$page=1;&lt;br /&gt;
}&lt;/strong&gt;&lt;br /&gt;
no result was found so show default of something&lt;/p&gt;
 </description>
     <pubDate>Tue, 07 Feb 2006 09:18:49 +0000</pubDate>
 <dc:creator>Busy</dc:creator>
 <guid isPermaLink="false">comment 1192774 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/if-var-contains-var#comment-1192754</link>
    <description> &lt;p&gt;Ok, so it is checking the variable $getPage against the number of rows.  I assume it&#039;s making sure that $getPage is somewhere in the number of rows, right?&lt;/p&gt;
&lt;p&gt;Could you just rephrase this last sentence?&lt;/p&gt;
&lt;p&gt;Not atually checking the page number, but how many times found in the database.&lt;/p&gt;
 </description>
     <pubDate>Tue, 07 Feb 2006 03:03:31 +0000</pubDate>
 <dc:creator>Dragon of Ice</dc:creator>
 <guid isPermaLink="false">comment 1192754 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/if-var-contains-var#comment-1192726</link>
    <description> &lt;p&gt;If you did just a copy and paste of his code then the problem is most likely just a missing ] after &#039;id&#039; in the first line&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;{&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_GET&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;id&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&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;$getPage is not an actual value (number, text), but a reference to the sql call.&lt;/p&gt;
&lt;p&gt;The second line is checking that reference to see how many rows were returned. If the page number someone requested is in your database, then 1 record will return, resulting in 1, if not match was found, it will return 0. Not atually checking the page number, but how many times found in the database.&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Mon, 06 Feb 2006 18:00:54 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1192726 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/if-var-contains-var#comment-1192674</link>
    <description> &lt;p&gt;Could you break this down a bit?  I think it does what I want, but I&#039;m not positive.&lt;/p&gt;
&lt;p&gt;The first line tells it to get information where the page id is whatever page the url says.&lt;br /&gt;
I think the second line is where it doesn&#039;t work.  Doesn&#039;t this just check to make sure the page id number is greater than 0?  I need it to be a number that exists in the list of pages.&lt;/p&gt;
&lt;p&gt;Please correct me if I&#039;m wrong, I&#039;m really new at this, and I just have to say thanks for your help!&lt;/p&gt;
 </description>
     <pubDate>Mon, 06 Feb 2006 03:27:04 +0000</pubDate>
 <dc:creator>Dragon of Ice</dc:creator>
 <guid isPermaLink="false">comment 1192674 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/if-var-contains-var#comment-1192670</link>
    <description> &lt;p&gt;Like Busy says, this seems like the long way round to me. Why not use a single mysql_query? It&#039;d look something like:&lt;/p&gt;
&lt;p&gt;$getPage=mysql_query(&quot;SELECT * FROM table WHERE id = {$_GET[&#039;id&#039;} LIMIT 1&quot;);&lt;/p&gt;
&lt;p&gt;if(mysql_num_rows($getPage)&amp;gt;0){&lt;br /&gt;
 $page=$_GET[&#039;page&#039;];&lt;br /&gt;
}else{&lt;br /&gt;
 $page=1;&lt;br /&gt;
}&lt;/p&gt;
 </description>
     <pubDate>Mon, 06 Feb 2006 02:34:43 +0000</pubDate>
 <dc:creator>Dux0r</dc:creator>
 <guid isPermaLink="false">comment 1192670 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/if-var-contains-var#comment-1192650</link>
    <description> &lt;p&gt;Wouldn&#039;t it be better to just check the url variable against what you have.&lt;br /&gt;
Your database could be megs big, putting all the info into an array (is how you&#039;d do it) would suck up a lot of unnecessary resources.&lt;/p&gt;
 </description>
     <pubDate>Sun, 05 Feb 2006 21:25:53 +0000</pubDate>
 <dc:creator>Busy</dc:creator>
 <guid isPermaLink="false">comment 1192650 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
