我试图用 PHP 制作一个 MySQL 单词,我想使用 session 将结果调用到下一页。所以我可以把结果放在 ms word 文件中,但是里面的值"$_SESSION['kode_faskes'] = $d['kode_faskes'];"
是null
.
注意:尝试访问第 80 行 C:\xampp\htdocs\test3\index.php 中 null 类型值的数组偏移量
这是代码
<!doctype html>
<html>
<head>
<title>Untitled Document</title>
<?php include 'connection.php'; ?>
</head>
<body>
<form action="index.php" method="get">
<label> Cari :</label>
<input type="text" name="cari">
<input type="submit" value="cari">
</form>
<?php
//search norek
if(isset($_GET['cari']))
{
$cari = $_GET['cari'];
echo "<b>Hasil Pencarian : ".$cari."</b>";
}
?>
<table width="600" border="1">
<?php
if(isset($_GET['cari']))
{
$cari = $_GET['cari'];
$dato = mysqli_query($connect, "
SELECT
*
FROM
faskes
INNER JOIN pemilik_rekening USING ( norek )
INNER JOIN transaksi USING ( kode_faskes )
WHERE transaksi.norek LIKE
'%".$cari."%'
");
} else {
$dato = mysqli_query($connect, "
SELECT
*
FROM
faskes
INNER JOIN pemilik_rekening USING ( norek )
INNER JOIN transaksi USING ( kode_faskes )
");
}
$no = 1;
while($d = mysqli_fetch_array($dato))
{
?>
<tr>
<td><?php echo $no++; ?></td>
<td><?php echo $d['kode_faskes']; ?></td>
<td><?php echo $d['nama_faskes']; ?></td>
<td><?php echo $d['alamat_faskes']; ?></td>
<td><?php echo $d['norek']; ?></td>
<td><?php echo $d['pemegang_norek']; ?></td>
<td><?php echo $d['tanggal_bayar']; ?></td>
<td><?php echo $d['jumlah_bayar']; ?></td>
</tr>
<?php }
session_start();
$_SESSION['cari'] = $cari;
$_SESSION['kode_faskes'] = $d['kode_faskes'];
?>
</table>
</body>
</html>
如果你能帮助我,我将不胜感激。
此外,我对简短的解释深表歉意。
莫回无