Query returns only first field in table

  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

I was hoping that my strange database class problem would solve my issue but I hasn't.

This code is kind of messy and poorly writen, but bare with me.

PHP Code: [ Select ]
if($id = $this->check($sterm))
      {
         // Term is already in table
         // return links
         $result_hour = mysql_query("SELECT url,title,score,trackback_total FROM ".$this->table['h']." WHERE search_term_id = ".$id." LIMIT 10",$this->link) or die(mysql_error());
         //trimmed same as above but for a different table
 
         $data = array();
         
         while($row_hour = mysql_fetch_array($result_hour))
         {
            $data [] = $row_hour;
         }
         
         $return_data->hour = $data;
         $data = array();
         
                        //trimmed same as above but for a different table
         
         return $return_data;
      }
  1. if($id = $this->check($sterm))
  2.       {
  3.          // Term is already in table
  4.          // return links
  5.          $result_hour = mysql_query("SELECT url,title,score,trackback_total FROM ".$this->table['h']." WHERE search_term_id = ".$id." LIMIT 10",$this->link) or die(mysql_error());
  6.          //trimmed same as above but for a different table
  7.  
  8.          $data = array();
  9.          
  10.          while($row_hour = mysql_fetch_array($result_hour))
  11.          {
  12.             $data [] = $row_hour;
  13.          }
  14.          
  15.          $return_data->hour = $data;
  16.          $data = array();
  17.          
  18.                         //trimmed same as above but for a different table
  19.          
  20.          return $return_data;
  21.       }


It only seems to return the first column in my table which is search_term_id. If I had a print_r($row_hour), I just get ten 1's printed (which is the value of search_term_id.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

Not sure exactly what I did to make this work, but it seems to be working now. My only guess is that memcache was some how still doing something, started working after I edit the query which is the md5 hash key memcache is using.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 110 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.