<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Online Cortex &#187; mySQL</title>
	<atom:link href="http://www.huginn.com/knuth/blog/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.huginn.com/knuth/blog</link>
	<description>Thoughts on Science and Technology</description>
	<lastBuildDate>Thu, 03 Jun 2010 04:26:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource</title>
		<link>http://www.huginn.com/knuth/blog/2009/01/31/warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result-resource/</link>
		<comments>http://www.huginn.com/knuth/blog/2009/01/31/warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result-resource/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 00:44:08 +0000</pubDate>
		<dc:creator>drknuth</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[mysql_num_rows]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.huginn.com/knuth/blog/?p=225</guid>
		<description><![CDATA[This is a note on an error that I have gotten several times when writing php scripts with mySQL.
The error is:
Warning:  mysql_num_rows(): supplied argument is not a valid MySQL result resource
The offending code snippet essentially looks like this:
$result = mysql_query(&#8220;$query_STRING&#8221; );
if (mysql_num_rows($result) &#62; 0)
{
which then continues on&#8230;
Note that $query_STRING is a string variable that [...]]]></description>
			<content:encoded><![CDATA[<p>This is a note on an error that I have gotten several times when writing php scripts with mySQL.</p>
<p>The error is:</p>
<blockquote><p><strong>Warning</strong>:  mysql_num_rows(): supplied argument is not a valid MySQL result resource</p></blockquote>
<p>The offending code snippet essentially looks like this:</p>
<blockquote><p>$result = mysql_query(&#8220;$query_STRING&#8221; );<br />
if (mysql_num_rows($result) &gt; 0)<br />
{</p>
<p>which then continues on&#8230;</p></blockquote>
<p>Note that $query_STRING is a string variable that contains the mySQL query.</p>
<p>The problem with this error message is that it is typically due to a problem in the query itself, and there can be many causes.  To catch the cause, change the line that performs the query to:</p>
<blockquote><p>$result = mysql_query(&#8220;$query_STRING&#8221; ) or die(mysql_error());</p></blockquote>
<p>The statement die(mysql_error()) will catch the true error and with luck give you a more meaningful error message.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.huginn.com/knuth/blog/2009/01/31/warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result-resource/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
