ユーザ用ツール

サイト用ツール

Writing /var/www/vhosts/w629.ws.domainking.cloud/enjoy-lei.com/lei_wiki/data/cache/f/ff44ec1d61f3fd7b089744ee5b8d4420.i failed
Unable to save cache file. Hint: disk full; file permissions; safe_mode setting.
Writing /var/www/vhosts/w629.ws.domainking.cloud/enjoy-lei.com/lei_wiki/data/cache/f/ff44ec1d61f3fd7b089744ee5b8d4420.metadata failed

codeigniterのdb処理
Writing /var/www/vhosts/w629.ws.domainking.cloud/enjoy-lei.com/lei_wiki/data/cache/f/ff44ec1d61f3fd7b089744ee5b8d4420.i failed
Unable to save cache file. Hint: disk full; file permissions; safe_mode setting.
Writing /var/www/vhosts/w629.ws.domainking.cloud/enjoy-lei.com/lei_wiki/data/cache/f/ff44ec1d61f3fd7b089744ee5b8d4420.xhtml failed

codeigniterのdb処理

class format_master extends CI_Model {

    function __construct()
    {
		// Model クラスのコンストラクタを呼び出す
		parent::__construct();
		// DB接続 (必須)
		$this->load->database();
    }

SQLでカラム名を取得

	/**
	 * SQLでカラム名を取得(標準)
	 * 
	 * @return string
	 */
	function get_select_data()
	{
		// SQLでデータ取得(LIMIT)
		$query = $this->db->get('format_master', 10, 20);
		foreach ($query->result() as $row)
		{
		    //echo $row->fm_file;
		    //echo "<br>";
		}
		return $query;
		
	}

SQLでデータ取得 </code>

/**
 * SQLでデータ取得(標準)
 * 
 * @return string
 */
function get_sql_format_master_data($fmUniqnum=0)
{
//バージョン確認
//echo $this->db->version();
	$sql = "SELECT * FROM format_master WHERE fm_uniqnum = ?";
	$values = array($fmUniqnum );
	
	$query = $this->db->query($sql, $values);
	
	return $query->result_array();
}

</code>

SQLでカラム名を取得

	/**
	 * SQLでカラム名を取得(標準)
	 * 
	 * @return string
	 */
	function get_select_join_data()
	{
	
		// 対象カラム名
		$this->db->select('*');
		// 対象テーブル名
		$this->db->from('format_master');
		// Joinテーブル名
		$this->db->join('format_tbl', 'format_tbl.fm_uniqnum = format_master.fm_uniqnum');
		// Wehre情報
		$whereArray = array(
							'format_tbl.fm_uniqnum' => 9249
							);
		$this->db->where($whereArray); 
		// Like
		//$this->db->like('title', 'match'); 
		
		// 取得
		$query = $this->db->get();
		
		// データ渡す(配列で返す)
		return $query->result_array();
	}
	

SQLでカラム名を取得

	/**
	 * SQLでカラム名を取得(標準)
	 * 
	 * @return string
	 */
	function get_table_data()
	{
		// SQLでデータ取得(LIMIT)
		$query = $this->db->get('format_master', 10, 20);
		foreach ($query->result() as $row)
		{
		    //echo $row->fm_file;
		    //echo "<br>";
		}
		return $query;
		
	}
codeigniterのdb処理.txt · 最終更新: 2014/11/27 19:17 by luis_lee