2015-02-04 50 views
0

有人能夠幫助處理非常煩人的數據庫錯誤。SQL 1064錯誤 - 腳本文件

您的SQL語法錯誤;檢查與您的MySQL服務器版本相對應的手冊,以便在第1行使用正確的語法''VALUES('0','Warning:')'

INSERT INTO possession_new(id,)VALUES('0' 「警告:」)」

我的代碼:

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();' 

腳本用於內部系統我建立這從我的登錄其他網站是由我公司擁有飼料我完全許可使用這個捲曲腳本,該腳本已經在過去的12個月,然而,其突然發展的牙齒問題....

有什麼建議嗎?

+1

釷與cURl無關 - 請編輯您的標題。 –

回答

3

錯誤消息清楚地顯示您的錯誤:$pos沒有任何值會打斷您的查詢。現在你需要弄清楚爲什麼

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

John,感謝您鑑別此事。 – user3096201

0

你列名後缺少列名id

INSERT INTO possession_new(ID)VALUES( '0', '警告:')」

你缺少名稱該列Warning應插入到,例如像

INSERT INTO possession_new的(ID,myColumnName)VALUES( '0', '警告:')」