Why won't Longtext data type display?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • damir
    New Member
    • Dec 2010
    • 14

    #1

    Why won't Longtext data type display?

    I have a problem with reading data from database. Everything displays correctly except the 'Message' row which doesn't show up at all.

    Problem is in the longtext data type. If I change it to mediumtext (or text) it works. Below is a table conf and a query.

    ID mediumint(8)
    Type tinyint(1)
    Title varchar(100)
    DateCreated datetime
    DateModified datetime
    Sender char(10)
    Recipients varchar(800)
    ReadBy varchar(800)
    Message longtext

    Code:
    SELECT ID, Type, Title, DateCreated, DateModified, Sender, Recipients, ReadBy, Message
    FROM G1_Messages
    WHERE ID=?
    I'm using the newest MAMP if it helps, and I have already changed php.ini memory limit to 64M, 128M, 256M and even 512M and nothing helps.
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    Where is the problem occurring,
    reading the DB, returning the data, processing the data or output?
    You also haven't described how or where display is.
    Put some debugging code to find where the problem is

    Comment

    • damir
      New Member
      • Dec 2010
      • 14

      #3
      Code:
      class Message
      {
         private $message = array();
         private $exists;
      
         public function __construct($db, $id)
         {
            // expends memory location
            ini_set('memory_limit', '64M');
      
            $query = 'SELECT ID, Type, Locked, Title, DateCreated, DateModified, Sender, Recipients, ReadBy, Message
                      FROM ' . Session::Get('GROUP') . '_Messages
                      WHERE ID=?';
      
            $stmt = $db->prepare($query);
            $stmt->bind_param('i', $id);
            $stmt->execute();
      
            $stmt->store_result();
            $this->exists = $stmt->affected_rows;
      
            if ($this->exists > 0)
               $this->message = fAssoc($stmt);
      
            $stmt->close();
         }
      
         public function Exist()
         {
            return ($this->exists == 0) ? false : true;
         }
      
         public function Get($argument)
         {
            return $this->message[$argument];
         }
      }
      Code:
      function fAssoc($stmt)
      {
         // creates associative array for the bind_result function
         $meta = $stmt->result_metadata();
         $parameters = array();
         $result = array ();
      
         while ($field = $meta->fetch_field())
            $parameters[] = &$row[$field->name];
      
         call_user_func_array(array($stmt, 'bind_result'), $parameters);
      
         while ($stmt->fetch())
         {
            foreach ($row as $key => $value)
               $result[$key] = $value;
         }
      
         return $result;
      }

      Comment

      Working...