Loading...

Follow PHP - Sunil on Feedspot

Continue with Google
Continue with Facebook
or

Valid
 
1
2
3
4
5
6
7
8
9
$string = "abcdef";
$result=[];
$strlen = strlen($string);
for($i=0;$i<$strlen;$i++)
{
    $result[$i]=$string[$i];
 
}
print_r($result);
 
 

$string = "abcdef";
$result=[];
$strlen = strlen($string);
for($i=0;$i<$strlen;$i++)
{
$result[$i]=$string[$i];
}
print_r($result);

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 
Webslesson Tutorial | Search HTML Table Data by using JQuery

JSON Live Data Search using Ajax JQuery Employee Data


    [ { "name":"Angel Lewis", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/3/000/0d4/2f7/07a3d35.jpg", "location":"Seattle, WA" }, { "name":"Justin Dean", "image": "https://media.licdn.com/mpr/mpr/shrink_100_100/AAEAAQAAAAAAAAIMAAAAJGExNTE4OWY4LWU4ODMtNDA2ZS1iNWI1LWNkYmIyOWMyMGQ5Zg.jpg", "location":"Muscatine, IA" }, { "name":"Nora Blake", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/2/005/0b8/118/387e091.jpg", "location":"Seattle, WA" }, { "name":"Russell Fox", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/2/000/084/26e/2d9e05b.jpg", "location":"Albuquerque, NM" }, { "name":"Daryl Bradley", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/3/000/042/0ad/197566e.jpg", "location":"Buckeystown, MD" }, { "name":"Benjamin Gonzales", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/8/005/0b2/1c9/2a423c1.jpg", "location":"Atlanta, GA" }, { "name":"Viola Francis", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/AAEAAQAAAAAAAASJAAAAJGMyMTUzN2EyLTExY2ItNDZiNS1hMTY1LTI4NDA2NDMwZmFkNg.jpg", "location":"Zanesville, OH" }, { "name":"Reginald Benson", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/1/000/10f/3cc/275a407.jpg", "location":"Gilbert, AZ" }, { "name":"Glenda Ray", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/8/005/0ac/1ca/07c25a2.jpg", "location":"Baltimore, MD" }, { "name":"Paula Vargas", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/5/005/03e/073/36a5c47.jpg", "location":"Baltimore, MD" }, { "name":"Mark Armstrong", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/5/005/010/09b/39b122d.jpg", "location":"Hallandale Beach, FL" }, { "name":"Jaime Campbell", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/AAEAAQAAAAAAAATUAAAAJDJkY2Q1Mzk0LTI1YzItNDFhNy04ZmQ0LWY3NzZlZTZlNGVmYw.jpg", "location":"Zanesville, OH" }, { "name":"Mike Beck", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/2/000/01c/0d4/2b69e7c.jpg", "location":"Garner, NC" }, { "name":"Ann Lowe", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/7/000/1f6/019/29cd853.jpg", "location":"Cabin John, MD" }, { "name":"Ryan Wolfe", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/1/000/0bf/335/05a57f6.jpg", "location":"Los Angeles, CA" }, { "name":"Dwayne Gutierrez", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/3/000/29b/028/2426536.jpg", "location":"San Jose, CA" }, { "name":"Bill Burke", "image": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/7/000/1bc/12e/1423106.jpg", "location":"Bakersfield, CA" } ]br />
    Read Full Article
    • Show original
    • .
    • Share
    • .
    • Favorite
    • .
    • Email
    • .
    • Add Tags 
     
    1
    <input type="file" name="image[]" id="form-field-2" placeholder="Select News Image For Uploading" class="col-xs-10 col-sm-5" required multiple="multiple" />
     
     

    <input type="file" name="image[]" id="form-field-2" placeholder="Select News Image For Uploading" required multiple="multiple" />
     
    01
    02
    03
    04
    05
    06
    07
    08
    09
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    <?php
            include "connection.php"; // include your database connection file
                                     
            if(isset($_POST['submit']))
                {
                        extract($_POST);
                        $i=0;                                          
                    $total = count($_FILES['image']['name']);
                                                 
                    for($i=0; $i<$total; $i++) {
                                                   
                     $tmpFilePath = $_FILES['image']['tmp_name'][$i];                                            
                     if ($tmpFilePath != ""){
                                                     
                     $img=md5(time());
                     $newFilePath ="".$img.$_FILES['image']['name'][$i];                                               
                if(move_uploaded_file($tmpFilePath, "../event/".$newFilePath)) {
                                                       
             $query=mysqli_query($con,"insert into event_photo(ep_e_id,ep_photo) values ('$title','$newFilePath')") or die(mysqli_error($con));
                                                     
              if($query==1) 
                                                     
                {
                                                         
     echo '<script type="text/javascript">';
                                                          
    echo 'alert("Event Image Uploaded Successfully...");';
    echo 'window.location.href = "add_event_photo.php";';
             echo '</script>';
         }
            else
            {                                                   
                echo"".mysqli_error($con);
                                         
                 }
                                             
        }
                                                 
    elseif(isset($_POST['cancel']))
                                                 
    {
                                                         
     echo '<script type="text/javascript">';
                                                  
                                                         
     echo 'window.location.href = "add_event_photo.php";';
                                                        
      echo '</script>';
                                             
        }
                                                 
        }
                                                   
                                                 
      }            
                                 
                                                 
    }
        
     
     

    <?php
    include "connection.php"; // include your database connection file

    if(isset($_POST['submit']))
    {
    extract($_POST);
    $i=0;
    $total = count($_FILES['image']['name']);

    for($i=0; $i<$total; $i++) {

    $tmpFilePath = $_FILES['image']['tmp_name'][$i];
    if ($tmpFilePath != ""){

    $img=md5(time());
    $newFilePath ="".$img.$_FILES['image']['name'][$i];
    if(move_uploaded_file($tmpFilePath, "../event/".$newFilePath)) {

    $query=mysqli_query($con,"insert into event_photo(ep_e_id,ep_photo) values ('$title','$newFilePath')") or die(mysqli_error($con));

    if($query==1)

    {

    echo '<script type="text/javascript">';

    echo 'alert("Event Image Uploaded Successfully...");';
    echo 'window.location.href = "add_event_photo.php";';
    echo '</script>';
    }
    else
    {
    echo"".mysqli_error($con);

    }

    }

    elseif(isset($_POST['cancel']))

    {

    echo '<script type="text/javascript">';


    echo 'window.location.href = "add_event_photo.php";';

    echo '</script>';

    }

    }


    }

    }

    Read Full Article
    • Show original
    • .
    • Share
    • .
    • Favorite
    • .
    • Email
    • .
    • Add Tags 
     
    01
    02
    03
    04
    05
    06
    07
    08
    09
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    <?php
     
        $con = mysqli_connect("localhost","root","","demo");
     
    date_default_timezone_set('Asia/Kolkata');
     
        $date=Date("Y-m-d");
     
     
        
     
        if(isset($_POST['submit']))
        {
            extract($_POST);
     
            $name1=$_FILES['photo']['name'];
      $type=$_FILES['photo']['type'];
      $size=$_FILES['photo']['size'];
      $temp=$_FILES['photo']['tmp_name'];
      if($name1){
     $upload= "posts/";
                $imgExt=strtolower(pathinfo($name1, PATHINFO_EXTENSION));
                $valid_ext= array('jpg','png','jpeg' );
                $photo= rand(1000,1000000).".".$imgExt;
                move_uploaded_file($temp,$upload.$photo);
              }
     
     
            $add=mysqli_query($con,"insert into file_upload(User_id, File_name, Date) values('1','$photo','$date')") or die(mysqli_error($con));
            if($add)
     
                     {
     
                       echo '<script type="text/javascript">';
                       echo " alert('data insert');";
                        
                       echo '</script>';
       
                          }
                         else
                         {
                         echo '<script type="text/javascript">';
                         echo " alert('data Not insert');";
                         echo '</script>';
                             
       
                         }
     
        }
     
        $view=mysqli_query($con,"select * from file_upload where User_id='1' and MONTH(`Date`) = MONTH(CURRENT_DATE()) AND YEAR(`Date`) = YEAR(CURRENT_DATE())") or die(mysqli_error($con));
     
        $fetch=mysqli_fetch_array($view);
        $a=mysqli_num_rows($view);
     
        ?>
     
        <!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <meta http-equiv="X-UA-Compatible" content="ie=edge">
            <title>File upload with 10 validation</title>
        </head>
        <body>
        <form method="post" enctype="multipart/form-data">
        <input type="file" name="photo" ><br>
        <?php  if($a >=10){?>
         
        <input type="submit" name="submit" value="Submit" disabled />
        <?php }else{  ?>   <input type="submit" name="submit" value="Submit"  /> <?php     } ?>
        </form>
        </body>
        </html>
     
     

    <?php

    $con = mysqli_connect("localhost","root","","demo");

    date_default_timezone_set('Asia/Kolkata');

    $date=Date("Y-m-d");




    if(isset($_POST['submit']))
    {
    extract($_POST);

    $name1=$_FILES['photo']['name'];
    $type=$_FILES['photo']['type'];
    $size=$_FILES['photo']['size'];
    $temp=$_FILES['photo']['tmp_name'];
    if($name1){
    $upload= "posts/";
    $imgExt=strtolower(pathinfo($name1, PATHINFO_EXTENSION));
    $valid_ext= array('jpg','png','jpeg' );
    $photo= rand(1000,1000000).".".$imgExt;
    move_uploaded_file($temp,$upload.$photo);
    }


    $add=mysqli_query($con,"insert into file_upload(User_id, File_name, Date) values('1','$photo','$date')") or die(mysqli_error($con));
    if($add)

    {

    echo '<script type="text/javascript">';
    echo " alert('data insert');";

    echo '</script>';

    }
    else
    {
    echo '<script type="text/javascript">';
    echo " alert('data Not insert');";
    echo '</script>';


    }

    }

    $view=mysqli_query($con,"select * from file_upload where User_id='1' and MONTH(`Date`) = MONTH(CURRENT_DATE()) AND YEAR(`Date`) = YEAR(CURRENT_DATE())") or die(mysqli_error($con));

    $fetch=mysqli_fetch_array($view);
    $a=mysqli_num_rows($view);

    ?>

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>File upload with 10 validation</title>
    </head>
    <body>
    <form method="post" enctype="multipart/form-data">
    <input type="file" name="photo" ><br>
    <?php if($a >=10){?>

    <input type="submit" name="submit" value="Submit" disabled />
    <?php }else{ ?> <input type="submit" name="submit" value="Submit" /> <?php } ?>
    </form>
    </body>
    </html>

    Read Full Article
    • Show original
    • .
    • Share
    • .
    • Favorite
    • .
    • Email
    • .
    • Add Tags 

    Separate tags by commas
    To access this feature, please upgrade your account.
    Start your free month
    Free Preview