How to Write Csv To Database table And Upload On Ftp Server In PHP

$ftpUrl = ‘Your Host’; $ftpUser = ‘Your FTP Username’; $ftpPassword = ‘Your FTP Password’; try  {     $conn_id = ftp_connect($ftpUrl);         if (false === $conn_id)         {           throw new Exception(‘Unable to connect’);         }         if (@ftp_login($conn_id, $ftpUser, $ftpPassword))         {             $dir = ‘Your FilePath/test.csv’;             $remote_file = basename($dir);             $myfile = fopen($dir, “w”) or die(“Unable to open file!”);             $title = “ID,Type,Name”;             fwrite($myfile, “$title“);             $result = $mysqli -> query(“SELECT * From Your_Table_name“);             while($row = mysqli_fetch_array($result))             {                 $display =‘”‘.$row[‘ID‘].‘”,”‘                 .$row[‘Type‘].‘”,”‘                 .$row[‘Name‘].‘”‘.“\n“;                 fwrite($myfile,“$display“);   …

Continue Reading

How to onlick call ajax and After Start count Down Does not chnage on refresh Page in Php

<a href=“javascript:void(0);” id=“priceatag” title=“Price account” onclick=“pricecsvgenerate(‘<?php echo $AccId;?>‘);“> <button type=“button” id=“pricesysc” class=“btn btn-default btn-circle”> <i class=“fas fa-sync”></i></button><span class=“countdown”></span></a> <div id=“demo”></div> <script> function calltimer() {     if( typeof sessionStorage.loginData === ‘undefined’)     {         $(‘#pricesysc’).removeAttr(“disabled”);         $(“#priceatag”).css({“pointer-events”: “”});     }     else     {     $(‘#pricesysc’).attr(“disabled”, true);     $(“#priceatag”).css({“pointer-events”: “none”});     console.log(sessionStorage.loginData);     var countDownDate = new Date(sessionStorage.loginData).getTime();     var x = setInterval(function() {     // $(‘#pricesysc’).attr(“disabled”, true);     var now = new Date().getTime();     var distance = countDownDate – now;     var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));     var seconds = Math.floor((distance % (1000 * 60)) / 1000);     // Output the result in an element with id=”demo”     document.getElementById(“demo”).innerHTML =  minutes + “m “ + seconds + “s “;     // If the count down is over, write some text      if (distance < 0)     {         clearInterval(x);         $(‘#pricesysc’).removeAttr(“disabled”);         $(“#priceatag”).css({“pointer-events”: “”});         sessionStorage.clear();         // location.reload();         document.getElementById(“demo”).innerHTML = “”;     }     }, 1000);     } } calltimer(); function pricecsvgenerate(obj) {   swal({         title: “Are you sure you want to Export Price csv?”,         type: “warning”,         showCancelButton: true,         confirmButtonColor: “#DD6B55”,         confirmButtonText: “Yes, Export!”,         closeOnConfirm: false     }, function(){         var dt = new Date();         // dt.setMinutes( dt.getMinutes()+1);;         // var hour = oldDate.getHours()         dt.setHours( dt.getHours()+1);         sessionStorage.setItem(“loginData”,dt);         $(‘#pricesysc’).attr(“disabled”, true);         $(“#priceatag”).css({“pointer-events”: “none”});         calltimer();         // location.reload();…

Continue Reading

How to Select direct Json decode object from table column in mysql in php

  price_formula refrence_code status {“firstcolumn”:”defaultprice”,”exchangerate”:”1.44″,”commission”:”8″,”calculationtype”:”flat”} MBB 1    SELECT *,price_formula->>‘$.firstcolumn‘ as firstcolumn,price_formula->>‘$.exchangerate’ as exchangerate,price_formula->>‘$.commission’ as commission,price_formula->>‘$.calculationtype’ as calculationtype FROM account_master where refrence_code=‘MBB‘ AND status=1 AND is_deleted=0 AND sync_product=‘1’

How to Codeigniter 3.1.2 To 3.1.11

1) Replace all files and directories in your system/ directory. ((OK)) 3.1.11 folder place 2) Remove usage of nice_date() helper (deprecation) replace with DateTime::createFromFormat($input_format, $input_date)->format($desired_output_format); => its in system folder so => (OK) 3) Remove usage of $config[‘standardize_newlines’] = make it false = (OK) 4) Remove usage of the APC Cache driver (deprecation) == we used in phpexcel library 5)…

Continue Reading

How to Connect S3 Aws Bucket And Get Image

public static function productImageGet($isbn13) { $path = getcwd(); require_once($path.’/application/third_party/s3/vendor/autoload.php’); $s3Url = “Yoururl“; $bucket = ‘Yourbucketname’; $credentials = new Aws\Credentials\Credentials(‘enter your accesskey’, ‘enteryourscretekey’); $s3 = new Aws\S3\S3Client([ ‘version’ => ‘latest’, ‘region’ => ‘eu-usa-1’, ‘credentials’ => $credentials ]); if($s3->doesObjectExist($bucket, ‘images/’.$isbn13.’.jpg’)) { return $s3Url.$isbn13.”.jpg”; } else { return $s3Url.”no-product-image.jpg”; // if($s3->doesObjectExist($bucket, ‘images/no-product-image.jpg’)) // { // return $s3Url.”no-product-image.jpg”; // } // else // {…

Continue Reading