当前位置: 首页>>代码示例>>PHP>>正文


PHP Files::find_by_sql方法代码示例

本文整理汇总了PHP中Files::find_by_sql方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::find_by_sql方法的具体用法?PHP Files::find_by_sql怎么用?PHP Files::find_by_sql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Files的用法示例。


在下文中一共展示了Files::find_by_sql方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Files

$thesis->comment_on_field = $_POST['proposed_field_brief'];
$thesis->applicant_id = $session->applicant_id;
$thesis->thesis_topic = $_POST['proposed_thesis_topic'];
$thesis->proposal_on_thesis = $_POST['thesis_proposal'];
$initiafilename = $_FILES['attach_thesis_proposal']['name'];
$thesis_details = $thesis->find_by_id($session->applicant_id);
if (!empty($thesis_details)) {
    $thesis->thesis_id = $thesis_details->thesis_id;
}
if ($thesis->save()) {
    if (!empty($_FILES['attach_thesis_proposal'])) {
        $files = new Files();
        //$file_details = $files->find_by_id($session->applicant_id);
        /*find file record for proposed thesis*/
        $sql_thesis_upload_file = "SELECT * FROM files WHERE applicant_id=" . $session->applicant_id . " AND caption='Thesis Proposal'";
        $result_thesis_upload_file = Files::find_by_sql($sql_thesis_upload_file);
        foreach ($result_thesis_upload_file as $row) {
            $thesis_file_id = $row->file_id;
            $thesis_filename = $row->filename;
        }
        $files->upload_dir = "documents" . DS . "thesis";
        if (!empty($thesis_file_id) && !empty($_FILES['attach_thesis_proposal']['name'])) {
            $files->file_id = $thesis_file_id;
            unlink(SITE_ROOT . DS . "documents" . DS . "thesis" . DS . $thesis_filename);
        }
        $arrayfiledetails = explode('.', $_FILES['attach_thesis_proposal']['name']);
        $extension = $arrayfiledetails[sizeof($arrayfiledetails) - 1];
        $_FILES['attach_thesis_proposal']['name'] = $session->applicant_id . '-thesis.' . $extension;
        if ($files->attach_file($_FILES['attach_thesis_proposal'])) {
            $files->caption = 'Thesis Proposal';
            $files->applicant_id = $session->applicant_id;
开发者ID:Ghaji,项目名称:form_application,代码行数:31,代码来源:ajax_proposed_thesis_details.php

示例2: MySQLDatabase

<?php

//$thesis_details = Thesis::find_by_id($session->applicant_id);
$db_upload_files = new MySQLDatabase();
$session = new Session();
/*find file record for degree certificate*/
$sql_deg_upload_file = "SELECT * FROM files WHERE applicant_id=" . $session->applicant_id;
$result_deg_upload_file = Files::find_by_sql($sql_deg_upload_file);
?>
<h3 align="center">Upload Relevant Documents</h3>
<hr>
<form action="" method="POST" class="uploadfiles form-horizontal" id="uploadfiles" >		
	    
	<br ><br >
		
			<input type="hidden" value="2097152" name="MAX_FILE_SIZE" />
			<div class="row-fluid">
				<div class="span7 offset2">
                	<div class="control-group">
                    	<div class="controls">
                            <h4>Note:</h4>
                            <p>The following documents are compulsory</p>
                            <ul>
                                <li>First degree certificate</li>
                                <li>NYSC discharge certificate</li>
                                
                            </ul>
                        </div>
                    </div>
                    
                    <div id="upload_docs">
开发者ID:Ghaji,项目名称:form_application,代码行数:31,代码来源:upload_files.php

示例3: customEncrypt

								<input type="hidden" name="aid" value="' . customEncrypt($applicant_id) . '" />
								</form>
							</tr>';
            $index++;
        }
        echo '</tbody>
		
		            </table>';
    }
}
?>
			
			
			<h4 align="center" class="alert alert-success">Attached Documents</h4>
		    <?php 
$files = Files::find_by_sql("SELECT * FROM files WHERE applicant_id='" . $applicant_id . "'");
if (empty($files)) {
    echo 'Not Attached';
} else {
    echo '
					<table class="table table-bordered table-hover">
		            	<thead>
		                	<th>S/N</th>
		                    <th>File</th>
		                    <th>Type</th>
							<th>Size</th>
		                </thead>';
    $index = 1;
    echo '<tbody>';
    foreach ($files as $file) {
        //$file = split("-", $file->filename);
开发者ID:Ghaji,项目名称:form_application,代码行数:31,代码来源:applicant_details.php

示例4: foreach

<?php

require_once '../inc/initialize.php';
$document_upload_msg = 0;
$empty_file_msg = 0;
$counter = 1;
$max = 5;
$upload_dir = "documents" . DS . "files";
foreach ($_FILES as $key => $value) {
    if (!empty($value) && $value["size"] != 0) {
        $sql = "SELECT * FROM files WHERE applicant_id=" . $session->applicant_id . " AND caption='Document " . $counter . "'";
        $result = Files::find_by_sql($sql);
        $result = array_shift($result);
        $document = new Files();
        $document->upload_dir = $upload_dir;
        if (!empty($result->file_id) && !empty($value['name'])) {
            $document->file_id = $result->file_id;
            unlink(SITE_ROOT . DS . $document->upload_dir . DS . $result->filename);
        }
        $filedetails = explode('.', $value['name']);
        $extension = $filedetails[sizeof($filedetails) - 1];
        $value['name'] = $session->applicant_id . '-Document-' . $counter . '.' . $extension;
        if ($document->attach_file($value)) {
            $document->caption = 'Document ' . $counter;
            $document->applicant_id = $session->applicant_id;
            if ($document->save()) {
                $document_upload_msg = 1;
            }
        } else {
            sleep(2);
            echo "<table>";
开发者ID:Ghaji,项目名称:form_application,代码行数:31,代码来源:ajax_upload_files.php


注:本文中的Files::find_by_sql方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。