General error: 2006 MySQL server has gone away while adding a thread


error while adding a thread to database showing this errors

Warning: Error while sending QUERY packet. PID=138803 in /home/u758467727/domains/joint2purchase.com/public_html/admin/add-thread.php on line 673  Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in /home/u758467727/domains/joint2purchase.com/public_html/admin/add-thread.php:673 Stack trace: #0 /home/u758467727/domains/joint2purchase.com/public_html/admin/add-thread.php(673): PDO->exec('CREATE TABLE IF...') #1 {main} thrown in /home/u758467727/domains/joint2purchase.com/public_html/admin/add-thread.php on line 673 

and code where this error is

$  sql = "CREATE TABLE IF NOT EXISTS $  lim (    ID INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,     USERNAME TEXT NULL,    REPLY TEXT NULL,    REPLYNAME TEXT NULL,    MESSAGE TEXT NULL,    DATE TEXT NULL,    IMAGE TEXT NULL,    TYPE TEXT NULL,     LIKES TEXT NULL,    TROPHY INT(11) DEFAULT 0,    MESSAGES INT(11) DEFAULT 0,    JOINED TEXT NULL,    FILES TEXT NULL,    PHOTOS TEXT NULL,    LIKERECEIVED INT(11) DEFAULT 0    )"; $  db->exec($  sql);