<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1039462" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1039462</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/sql-count#comment-1223599</link>
    <description> &lt;p&gt;Greg, that&#039;s why you use something to get rid of those characters, assuming you&#039;re accepting data from an outside source.  Either a homegrown solution, or something like html_entities...  converts things to their HTML char value instead of leaving them as they are.&lt;/p&gt;
&lt;p&gt;If the source is internal, then I agree to your logic.&lt;/p&gt;
 </description>
     <pubDate>Mon, 27 Aug 2007 15:48:38 +0000</pubDate>
 <dc:creator>brady.k</dc:creator>
 <guid isPermaLink="false">comment 1223599 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/sql-count#comment-1223594</link>
    <description> &lt;p&gt;This is something I always recommend to people who get errors with a query in PHP:&lt;/p&gt;
&lt;p&gt;Right before you execute the query, display the sql statement to make sure it looks formatted well. (when mixing in variables while building it, easy to miss a improper quote or missing comma, etc).  Also you should validate the  Request.Querystring(&quot;user&quot;) and make sure any quotes are escaped (not sure how to do this in ASP), say that Request.Querystring(&quot;user&quot;) was set to &lt;strong&gt;o&#039;neil&lt;/strong&gt;  the single quote would mess you up. (even if your test value doesn&#039;t have one, being that it is something that a user can manually change by changing the URL, you wll want to protect against single quotes and semicolons if ASP/MSSQL let you stack multiple statements in one query execution&lt;/p&gt;
&lt;p&gt;Imaging if I called it with a query string of &lt;strong&gt;bob&#039;; DELETE FROM urlveiws WHERE profilefor = &#039;%&lt;/strong&gt; (or whichever character is the wildcard in MSSQL), the executed query would be:&lt;/p&gt;
&lt;p&gt;SELECT COUNT(*) FROM urlviews WHERE profilefor = &#039;bob&#039;; DELETE FROM urlveiws WHERE profilefor = &#039;%&#039;&lt;/p&gt;
&lt;p&gt;As you can see... bye bye data...&lt;/p&gt;
&lt;p&gt;If the sql statement does look formatted fine and everything, then take it and manually run it on the database (not sure what MS SQL has for manually running a SQL statement. In PHP with mySQL, you can sometimes get a more detailed error when running it directly on the database.&lt;/p&gt;
 </description>
     <pubDate>Mon, 27 Aug 2007 14:25:24 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1223594 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/sql-count#comment-1223593</link>
    <description> &lt;p&gt;Are you trying to count the number of results returned?  I&#039;ve never seen &quot;SELECT COUNT&quot; before, but this is how I would structure a &#039;count results&#039; query (in PHP, but the SQL is the same):&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;$sql &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 urlviews WHERE profilefor = &#039;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;\&quot;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$n_rows&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = mysql_num_rows(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$sql&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;The other issue may be, if your syntax is correct/valid, that the database/table/field you are referencing doesn&#039;t exist, or is spelled differently...&lt;/p&gt;
&lt;p&gt;Finally, since I don&#039;t know how to do this in ASP and how it handles errors, does this mean that what you happened to be looking for doesn&#039;t exist?  Meaning if you wanted profilefor = &#039;KyleBrady&#039; and there is no username of &#039;KyleBrady&#039;... does it return what you&#039;re getting?&lt;/p&gt;
 </description>
     <pubDate>Mon, 27 Aug 2007 14:05:41 +0000</pubDate>
 <dc:creator>brady.k</dc:creator>
 <guid isPermaLink="false">comment 1223593 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
