Apply for Zend Framework Certification Training

Mysql





if(isset($_POST["import"])){
   date_default_timezone_set("Asia/Calcutta"); 
   $targetPath = 'uploads/'.$_FILES['file']['name'];
   move_uploaded_file($_FILES['file']['tmp_name'], $targetPath);
   $filename = $targetPath;
   $the_big_array = []; 
         if (($h = fopen("{$filename}", "r")) !== FALSE){
		while (($data = fgetcsv($h, 1000, ",")) !== FALSE){
		       $name = $data[0];
			$phone = $data[1];
			$email = $data[2];
			$source = $data[3];
			if($name == ""){
			}else{
			$select = "select phone,email from enquiry where phone ='$phone' or email ='$email'";
                        $mq = mysql_query($select);
                        $mfa = mysql_fetch_row($mq);
                        if($mfa >= 1){
                        }else{
			       $query = "insert into enquiry(name,phone,email,website_work,user_id,
                               assigned_to_user_id,action_time)
                               values('$name','$phone','$email','$source','1','1',CURDATE())";
			       $result = mysql_query($query) or die(mysql_error());
			}
			echo "File Uploaded Successfully";
		}
               
		}
        
	}
}
?>



 <div class="outer-container">
        <form action="" method="post" name="frmExcelImport" 
                               id="frmExcelImport" enctype="multipart/form-data">
            <table align="center" width="600">
                <tr>
			<td><label>Choose CSV File</label> </td>
                        <td><input type="file" name="file"  id="file" accept=".xls,.xlsx"></td>
			<td><button type="submit" id="submit" name="import" class="btn-submit">Import</button></td>
		</tr>
	</table>
        </form>
    </div>
    <div id="response" class="<?php if(!empty($type)) { echo $type . " display-block"; } ?>">
             <?php if(!empty($message)) { echo $message; } ?></div>                                    

< MySQL - select data from database between two dates MySQL INNER JOIN >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top