<?php //
/**********************************************************************
***********************************************************************/
function add_project_section($project_id, $section_name, $description)
{   
        $id_user = $_SESSION['wa_current_user']->user;
        $datetime = date('Y-m-d H:i:s');
                
        $sql = "INSERT INTO ".TB_PREF."project_sections (
                            project_id, 
                            section_name,
                            description,
                            created_by, created_on) 
                VALUES (".db_escape($project_id).", "
                            .db_escape($section_name).","
                            .db_escape($description).","
                            .db_escape($id_user). ","
                            .db_escape($datetime).")";

        db_query($sql,"add_project_section");		
}

function update_project_section($selected_id, $section_name, $description)
{
        $id_user = $_SESSION['wa_current_user']->user;
        $datetime = date('Y-m-d H:i:s');
        
        $sql = "UPDATE ".TB_PREF."project_sections 
                SET section_name=".db_escape($section_name).", 
                            description=".db_escape($description).",       
                            updated_by=".db_escape($id_user).",                                    
                            updated_on=".db_escape($datetime)."
                WHERE id=".db_escape($selected_id);

       db_query($sql,"update_project_section");		
}


function get_project_sections($project_id)
{
     
        $sql = "SELECT * 
                FROM ".TB_PREF."project_sections 
                WHERE project_id = ".db_escape($project_id);
                    
               
	return db_query($sql,"get_project_sections");
    
}

function get_project_section_details($section_id)
{
	$sql = "SELECT * FROM ".TB_PREF."project_sections WHERE id=".db_escape($section_id);
	
	$result = db_query($sql,"get_project_section_details");
	
	return db_fetch($result);
}



?>