PHP query to mysql database returns emtpy data, but Query Browser shows records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

Here is the query:

     function ReturnPackageDescriptions($pack, $cat, $hotcat, $hotid){
             $comIB = $cat . " " . $pack . " " . $hotcat . " " . $hotid;
          $catLength = strlen($comIB);
          echo $catLength;
          $query = "SELECT description from cpProducts where category='" . $cat . " " . $pack . " " . $hotcat . " " . $hotid . "'";
          echo "<bR>" . $query . "<br>";
             echo "combined package number = " . $comIB . "<br>";
               $retval = "";
          $link = mysql_connect($config['host'],$config['user'],$config['pass']) or die("Could not connect");
              mysql_select_db('stc_store') or die("Unable to connect to the default database");
                  $result = mysql_query($query) or die("Unable to pull the menu objects for main event details");
          echo mysql_affected_rows() . "<br>";
                while ($results = mysql_fetch_array($result, MYSQL_ASSOC)){
                     extract($results);
                   echo $description;
               $retval = $description;
          }
          
             mysql_free_result($result);
             mysql_close($link);
          return $retval;
  }

I have some extra 'echo' statements to see the progress on the web page. If I remove the 'where' clause within the SQL statement, I get rows. But when I add the 'where' portion, no records are returned.

Here is an example of what the query looks like:

$query example = SELECT description from cpProducts where category='39 47 48 172'

When I run the same query in MYSQL Control center or Query Browser, no problem. I use this function template for my SELECT statements.

Please let me know if there is something missing from the code.

Thanks.

 

 

Jason Walker

jwalker@xxxxxxxxxxxxxxx

http://www.desktophero.com

 

No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.298 / Virus Database: 265.6.8 - Release Date: 1/3/2005

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux