<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1044377" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1044377</link>
    <description></description>
    <language>en</language>
          <item>
    <title>Greg,
Thanks!
I still have</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/mystery-mysql-query#comment-1243413</link>
    <description> &lt;p&gt;Greg,&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;I still have no idea what I did wrong. It must&#039;ve been a typo. I assume (not knowing much about PHP or MySQL) that the db_query and db_fetch_array functions are Drupal-specific.&lt;/p&gt;
&lt;p&gt;The reason I posted here was that I was convinced that the query produced 2 rows (which is what it did when I ran it under the mysql command line), which was why it was so baffling. In the end it appeared that the problem lay in the Case of the query string and when the correct case was applied both rows were returned.&lt;/p&gt;
&lt;p&gt;Mental.&lt;/p&gt;
 </description>
     <pubDate>Mon, 13 Jul 2009 20:56:53 +0000</pubDate>
 <dc:creator>davecoventry</dc:creator>
 <guid isPermaLink="false">comment 1243413 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>LOL, i see you found it</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/mystery-mysql-query#comment-1243409</link>
    <description> &lt;p&gt;LOL, i see you found it while i was typing up my response (I&#039;m at work and get interrupted while replying &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;. Glad you found it.&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Mon, 13 Jul 2009 13:51:31 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1243409 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Without knowing what the</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/mystery-mysql-query#comment-1243408</link>
    <description> &lt;p&gt;Without knowing what the custom function db_query and db_fetch_array do, I&#039;ll assume they are close to mysql_db_query and mysql_fetch_array.&lt;/p&gt;
&lt;p&gt;I never used mysql_db_query, and looked it up, one thing mentioned in there was something about making sure you specify the database/table names in the query if you are switching across different ones.&lt;/p&gt;
&lt;p&gt;One of the first things I do when a query doesn&#039;t seem to work is immediately before the query, echo it out, especially when you are putting variables in there.&lt;/p&gt;
&lt;p&gt;Another thing is to do a var_dump of the result variable ($query). You may be assuming that it is returning no rows based upon your if statement, but it could actually be that $query is false indicating there was an error in the query itself, and depending on error reporting, you didn&#039;t see it. (ie. you manually ran the query on one database, yet the php ran it on another one?)&lt;/p&gt;
&lt;p&gt;Also on a side note, since you are just getting one value from the query, there is really no need for the foreach() statement, simply do $ret_val[] = $row[0]; (assuming db_fetch_array returns a number indexed array).&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Mon, 13 Jul 2009 13:49:54 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1243408 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Just about tearing my hair</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/mystery-mysql-query#comment-1243407</link>
    <description> &lt;p&gt;Just about tearing my hair out here. I&#039;ve battled for hour on this.&lt;/p&gt;
&lt;p&gt;This doesn&#039;t work:&lt;br /&gt;
sql=&#039;SELECT uid FROM drup_profile_values WHERE fid=1 AND UPPER(value) LIKE UPPER(&quot;%david%&quot;) AND uid&amp;gt;1&#039;;&lt;/p&gt;
&lt;p&gt;But THIS does:&lt;br /&gt;
sql=&#039;SELECT uid FROM drup_profile_values WHERE fid=1 AND UPPER(value) LIKE &quot;%DAVID%&quot; AND uid&amp;gt;1&#039;;&lt;/p&gt;
&lt;p&gt;Beats me. Still, at least I can get it to work.&lt;/p&gt;
 </description>
     <pubDate>Mon, 13 Jul 2009 13:42:34 +0000</pubDate>
 <dc:creator>davecoventry</dc:creator>
 <guid isPermaLink="false">comment 1243407 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
