2017-06-18 79 views
0

如何將數據發佈到數據庫以迫使它全部爲大寫? 這是我的代碼:如何使用strtoupper將數據以大寫形式發佈到數據庫

$student_id = $this->input->post('student_id'); 
    $course_id   = $this->input->post('course_id'); 

這是我做了什麼:

$student_id = strtoupper($this->input->post('student_id')); 
    $course_id   = strtoupper($this->input->post('course_id')); 

結果: 數據發佈爲小寫保持原樣。

回答

0

也許你可以將你的輸入強制轉換爲字符串,以防未識別出正確的類型。

$student_id = strtoupper((string)$this->input->post('student_id')); 
$course_id  = strtoupper((string)$this->input->post('course_id')); 
+0

試過這個。仍然是相同的輸出即時 –

+0

然後可能錯誤來自其他地方。從一開始就檢查您的代碼或向我們展示該功能的更大部分。嘗試設置爲大寫簡單的字符串「測試」,看看它是否工作。檢查這部分之前或之後是否有任何可能影響數據結構的更改。 –

相關問題