我要把 type字段的值传到content.php页,下面的代码哪里不对???title.php页
<?php
$query=mysql_query("select type from tb_zl_type");
while($myrow=mysql_fetch_array($query)){
?>
<table width="170" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="182" height="29" align="center" background="Images/xuexiaogk/bg08.jpg" onClick="" ><?php echo "<a href=content.php?type=".$myrow['type']." >".$myrow[type]."</a>"?></td>
<?php };?>
content.php页<?phpif($_GET['type']){
$type=$_GET['type'];
$query=mysql_query("select * from tb_zl where type='$type'",$conn);
$row=mysql_fetch_array($query);
echo "$row[title]"; //打印文章标题
}else{ //如果没有选择哪篇文章就打印第一篇
$query=mysql_query("select * from tb_zl order by id asc limit 1",$conn);
$row=mysql_fetch_array($query);
echo "$row[title]";
}
?>
<?php
$query=mysql_query("select type from tb_zl_type");
while($myrow=mysql_fetch_array($query)){
?>
<table width="170" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="182" height="29" align="center" background="Images/xuexiaogk/bg08.jpg" onClick="" ><?php echo "<a href=content.php?type=".$myrow['type']." >".$myrow[type]."</a>"?></td>
<?php };?>
content.php页<?phpif($_GET['type']){
$type=$_GET['type'];
$query=mysql_query("select * from tb_zl where type='$type'",$conn);
$row=mysql_fetch_array($query);
echo "$row[title]"; //打印文章标题
}else{ //如果没有选择哪篇文章就打印第一篇
$query=mysql_query("select * from tb_zl order by id asc limit 1",$conn);
$row=mysql_fetch_array($query);
echo "$row[title]";
}
?>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货