在两个数组上获取不同的值和相似的值

时间:2020-08-21 09:02:50

标签: php arrays arraylist

在这里,我试图从arrays数据库中获取的两个不同的MYSQL中查找相同的值和不同的值。以下是我尝试完成的代码,但看不到任何结果,包括没有错误。 testing_details表示我从JSON获取的database值。

以下是代码:

<?php
  include ('auth/dbconnection.php');

   $stmt2 = $conn->prepare("SELECT * FROM testing_schedule AS t INNER JOIN  prescription AS p ON  
   t.p_id=p.p_id AND p.date=curdate() AND p.apt_id=? ");
   $stmt2->bind_param("s", $_GET['aptid']);
   $stmt2->execute();
   $result2 = $stmt2->get_result();
   if($result2->num_rows === 0)  ;
   while($row = $result2->fetch_assoc()) {

    $testing_perform= $row['testing_perform'];
    $found = false;

$testing_details = json_decode($row['testing_details'],true);

    if (is_array($testing_details) || is_object($testing_details)) {
        if (is_array($testing_perform) || is_object($testing_perform)) {

        foreach($testing_details as $key => $object) {
            $found = false;

            foreach ($testing_perform as $keys => $object2) {
                if ($object == $object2) {
      
 ?>

                <tr>
                   <td>2</td>
                   <td><a href="invoice-view.php">#INV-0002</a></td>
                   <td><?php    echo '<br>'. $object2 .': check ';     
                    $found = true; ?>  </td>
                    <td>24 Aug 2018</td>
                    <td>24 Aug 2018</td>
                    <td>$6</td>
                    <td><span class="custom-badge status-blue">Sent</span></td>
                    <td class="text-right">
                     </td>
              </tr>
                                
   <?php  }} }  } } } ?>

下面的图片表示两个数组如何存储在数据库(DB schema) ...

testing_perform:

testing perporm

testing_details:

testing_details

我真的很感谢有人可以帮助我。谢谢

0 个答案:

没有答案