我有这种情况(mysql + php):
mysql: `| employee | visitday | customername | picnumber | picpath |
----------------------------------------------------------------
| agent 1 | 2014-02-16 | customer | 1 |c:....jpg |
| agent 2 | 2014-01-11 | customer | 1 |c:....jpg |`
在我的网站,我有这样一个树菜单:员工-> visitday -> customername,基于mysql
当我点击customername打开一个带有客户图片的图片库时,我该怎么做呢?
thx .
我猜你有一个名为customer。php的文件
,那么菜单中指向该客户的链接可以是这样的:customer.php?name = customername
,然后在customer.php中使用如下:
<?php
$customer = $_GET['name'];
if(isset($customer) && !empty($customer)) {
$query = mysql_query("SELECT `id`, `customername`, `picpath` FROM `the table name` WHERE `customername` = '$customer'");
echo '<table>
<tr> <th>Foto</th> </tr><tr>';
while( $associate = mysql_num_rows($query)) {
echo '<td><img src="'.$associate['picpath'].'"></td>
</tr><tr>';
}
echo '</tr>
</table>';
} else {
header('Location: index.php');
exit();
}
?>