我对PHP不太熟悉。
我想在html中编写表标签,在abc.php文件中,而不是使用php标签在db_connect文件中设计它。
我在db_connect文件中调用该函数的文件(abc)。
<?php
include('a_header.php');
include_once('classes/class.database.php');
$db = new db();
?>
<div id="table1 >
<?php
echo "<table border='1' width='300px' >
<tr>
<th>Name</th>
<th>Email</th>
</tr>";
?>
</div>
<?php
$res2 = $db->get_patients();
include('a_footer.php');?>
这是我在db_connect文件中编写的函数。
<?php
class db{
function get_patients($name=NULL,$email=NULL,$username='gayani'){
$query2 = "select distinct a.name, a.email from patient a,doctor_patient b, doctor c where c.username='".$username."' and c.username=b.doc_name and b.serial_no=a.serial_no" ;
. " and name='".$name."';";
$res2 = mysql_query($query2,$this->con);
while($row2 = mysql_fetch_array($res2)){
echo "<tr>";
echo "<td> <a href='v_patient.php'/>" . $row2['name'] . "</td>";
echo "<td>" . $row2['email'] . "</td>";
echo "</tr>";
}
echo "</table>";
}
我想在html中编写表标记,在abc.php文件中,而不是使用php标记在db_connect文件中设计它。我尝试过这个。但它不起作用。帮帮我们