if statement is true , but its not working in PHP

ساخت وبلاگ
Please see below code, when if statement is true then its showing the result of else statement.

Code:

        <?php
                include 'db_connection.php';
                include 'reader.php';       
                        $file="sample.xls";
                        $connection=new Spreadsheet_Excel_Reader();
                        $connection->read($file);       
                        $startrow=1;
                        $endrow=2;
                        $col1=1;
                        $col2=2;
                        $col3=3;
                        for($i=$startrow;$i<$endrow;$i++){
                        $rrt1= $connection->sheets[0]["cells"][$i][$col1]."<br>";               
                        $rrt2= $connection->sheets[0]["cells"][$i][$col2]."<br>";               
                        $rrt3= $connection->sheets[0]["cells"][$i][$col3]."<br>";               
                        echo $rrt1;               
                        echo $rrt2;               
                        echo $rrt3;                       
                        }
                        if ($rrt1 == "Name" || $rrt2 == "job" || $rrt3 == "email") {
                        $x=2;
                        while($x<=$connection->sheets[0]['numRows']) {
                        $name = isset($connection->sheets[0]['cells'][$x][1]) ? $connection->sheets[0]['cells'][$x][1] : '';
                        $job = isset($connection->sheets[0]['cells'][$x][2]) ? $connection->sheets[0]['cells'][$x][2] : '';
                        $email = isset($connection->sheets[0]['cells'][$x][3]) ? $connection->sheets[0]['cells'][$x][3] : '';
                               
                        $sql_insert="INSERT INTO users_details (id,name,job,email) VALUES ('','$name','$job','$email')";
                        $result_insert = mysqli_query($conn,$sql_insert) or die(mysql_error());
                               
                          $x++;
                        }
                        }
                        else {
    echo "Not matching!";
}
        ?>

Getting below result

Click image for larger version. 
Name:	rrrr.JPG 
Views:	9 
Size:	12.5 KB 
ID:	17438
Attached Thumbnails
Click image for larger version. 
Name:	rrrr.JPG 
Views:	N/A 
Size:	12.5 KB 
ID:	17438 
CodingForums...
ما را در سایت CodingForums دنبال می کنید

برچسب : نویسنده : codingforums بازدید : 178 تاريخ : پنجشنبه 30 شهريور 1396 ساعت: 17:45