我有一个带有td的动态表原始文件,它显示mysql数据库中的数据。 现在,我想将tr中的td链接到我的文件夹中保存的与td类似名称的pdf。由于名称并不总是相同,因此我需要在文件夹中搜索t中有td的字符,然后单击td即可找到匹配的pdf
注意:文件夹位于htdocs / wells /
文件示例:
htdocs / wells / AMGR-2 / Composite200.pdf htdocs / wells / AMGR-2 / Composite500.pdf
<td width="230" class="left"> <a href="../loglib/wells/<?php echo $rowcd['no'] ?>/<?php echo $rowl['log'] ?>*<?php echo $rowl['scale'] ?>*.pdf"> <?php echo $rowl['log'] ?></td>
我尝试过这种方式
<table id="singlewell" class="main">
<thead>
<tr >
<th width="100">Well No</th>
<th width="75">Well Name</th>
<th width="100">Status</th>
<th width="100">Issued to</th>
<th width="75">Log #</th>
<th width="230">Logs</th>
<th width="50">Scale</th>
<th width="40">BLI</th>
<th width="40">TLI</th>
<th width="100">Date of Log</th>
</tr>
</thead>
<?php
while($rowcd = $resultw->fetch_assoc()){
?>
<tr>
<td align="center" width="100"><?php echo $rowcd['no'] ?></td>
<td align="center" width="75"><?php echo $rowcd['name'] ?></td>
<td colspan="8">
<table class="child">
<tr>
<?php
$queryl = "select * from logs where pid=".$rowcd['id']." order by date desc";
//$queryl = "select * from logs where pid=".$rowcd['id'];
$resultl = $con->query($queryl);
while($rowl = $resultl->fetch_assoc()){
$dd = strtotime($rowl['date']);
$myFormatForView = date("d-m-Y", $dd);
if($myFormatForView=='01-01-1970'){
$myFormatForView1='';
}else
{
$myFormatForView1=$myFormatForView;
}
?>
<td width="100"><?php echo $rowl['status'] ?></a></td>
<td width="100"><?php echo wordwrap($rowl['rcvr'],10,"<br>\n",TRUE) ?</td>
<td width="75"><?php echo $rowl['lno']. "/" .$rowcd['rackno'] ?></td>
<td width="230" class="left"> <a href="../loglib/wells/<?php echo
$rowcd['no'] ?>/<?php echo $rowl['log'] ?><?php echo $rowl['scale'] ?
>.pdf"><?php echo $rowl['log'] ?></td>
<td width="50" align="center"><?php echo $rowl['scale'] ?></td>
<td width="40" align="center"><?php echo $rowl['bottom'] ?></td>
<td width="40" align="center"><?php echo $rowl['top'] ?></td>
<td width="100" align="center"><?php echo $myFormatForView ?></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
</td>
<?php
}
}
?>
</tr>
</table>