SQL 1064错误 - 损坏的脚本

would someone be able to help with a very annoying database error.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('0', 'Warning:')' at line 1

INSERT INTO possession_new (id, ) VALUES ('0', 'Warning:')"

My code:

John, thanks for identifying this. I can't seem to identify why the $pos variable has no value? 

          '$pos = '';
                foreach($html_base->find('td[width=120]') as $k)
                {
                    if(trim($k->plaintext) != '')
                    {
                        $pos .= 'poss_'.str_replace(' ', '_', substr(trim($k->plaintext), 0, -1)).", ";
                    }
                }

                $pos_detail = '';
                foreach($html_base->find('td[class=color_text_view]b') as $k)
                {
                    $pos_detail .= "'".mysql_real_escape_string(trim($k->plaintext))."', ";
                }

                foreach($html_base->find('td[width=250], td[width=251], td[width=621]') as $td)
                {
                    $input = $td->find('input[type=text], input[type=checkbox], input[name=manager], textarea');
                    foreach($input as $in)
                    {
                        if($in->getAttribute('name') == 'manager')
                        {
                            $pos_detail .= "'".mysql_real_escape_string(trim($td->plaintext))."', ";
                            continue;
                        }
                        elseif($in->hasAttribute('rows'))
                        {
                            $pos_detail .= "'".mysql_real_escape_string(trim($td->plaintext))."', ";
                            continue;
                        }

                        elseif($in->getAttribute('name') == 'critical')
                        {
                            if($in->hasAttribute('checked'))
                            {
                                $pos_detail .= "'Y', ";
                                continue;
                            }
                            elseif(!$in->hasAttribute('checked'))
                            {
                                $pos_detail .= "'N', ";
                                continue;
                            }
                        }
                        elseif($in->getAttribute('name') == 'library')
                        {
                            if($in->hasAttribute('checked'))
                            {
                                $pos_detail .= "'Y', ";
                                continue;
                            }
                            elseif(!$in->hasAttribute('checked'))
                            {
                                $pos_detail .= "'N', ";
                                continue;
                            }
                        }
                        else
                        {
                            $pos_detail .= "'".mysql_real_escape_string(trim($in->getAttribute('value')))."', ";
                        }


                    }
                    if(!$td->find('input') && $td->previousSibling()=='<td width="120">PICOP:</td>')
                    {
                        $pos_detail .= "'', ";
                    }
                }

                $pos = substr($pos, 0, -2);
                $pos_detail = substr($pos_detail, 0, -2);

                $possession = "INSERT INTO possession_new ".
                       "(id, $pos) ".
                       "VALUES ".
                       "('0', $pos_detail)";
                $this->db->query($possession);
                $possession_insert_id = $this->db->insert_id();'

the script is used for an internal system I build which feeds from another site from my login which is owned by my company. I have full permission to use this curl script, the script has worked for the last 12 months however, its suddenly developed teething issues....

Any advice?

The error message shows your error clearly: $pos has no value which breaks your query. Now you need to figure out why.

INSERT INTO possession_new (id, ) VALUES ('0', 'Warning:')"
                             ^^^^^
                            MISSING

You are missing a column name after the column name id

INSERT INTO possession_new (id, ) VALUES ('0', 'Warning:')"

You are missing the name of the column that Warning should be inserted to, e.g. something like

INSERT INTO possession_new (id, myColumnName) VALUES ('0', 'Warning:')"