Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to fetch data from array using php ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 110
    Comment on it

    You can take reference form below example to fetch data from array list using php.

    This method is really very easy.

    <?php
    
    // you have to Decode the array and store a variable
    $GetRecord = json_decode('[{"Name":"Mac","age":"25"},{"Name":"Warner","age":"30"},{"Name":"Cris","age":"22"},{"Name":"Broad", "age":"40"},{"Name":"Joe","age":""}]');
    
    
    // Loop for find the array value
    foreach ($GetRecord as $key => $value) {
    
        if ($value->Name == Mac && ($value->age == 25 ))
         {
    
            echo 'success-! Record found ';
            exit;
        }else{
             echo ' Error-! Record not found';
             exit;
        }
    }
    
    ?>
    

    If name and age exist in given array list then result will come "success-! Record found". If name and age not exist in given array list then result will come "Error-! Record not found".

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: