在这里,我试图从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_details:
我真的很感谢有人可以帮助我。谢谢