求教一个php调用数据库输出的问题
目的是做一个 选择范围然后 通过这些范围查询数据库并格式化输出结果的
但是做到输出就出问题了 弄了半天很不理解
以下是错误部分代码
mysql_query('set names gbk',$conn);mysql_select_db('htc',$conn);$count = 'select count(*) from phone';$query = mysql_query($count,$conn);//记录总数$recordcount = mysql_result($query, 0,0);//每页多条$pagesize = 5;//总页数$pagecount = ceil($recordcount/$pagesize);//当前页$currpage = 1;if($_GET){ $currpage = (int)$_GET['p']; } $currpage = $currpage<1 ? 1 : $currpage; $currpage = $currpage>$pagecount ? $pagecount : $currpage; $start = ($currpage-1)*$pagesize; $sql = "select * from phone order by id desc limit $start,$pagesize"; $result = mysql_query($sql,$conn); while($row=mysql_fetch_array($result)){ foreach ($row as $k=>$va){ //echo '<pre>'; //print_r($row); echo "<div class='p_list'>"; echo "<div class='p_list_pic'><a><img src="."'image/'.$va[13]".">"."</img></a></div>"; echo "<div class='p_list_con'> <p class='p_list_con_title'>$va[1]</p><br> $va[4],$va[5]<br> $va[6],$va[7]<br> $va[8],$va[9]<br> <p class='p_list_con_state'>$va[10]</p></div>"; echo "<div>售价:¥$va[3]<br> <img src='image/gm.gif'></img></div>"; echo "</div>"; //echo '</pre>'; } } echo '<a href=?p=1>首页</a> '; echo '<a href=?p='.($currpage+1).'>下页</a> '; echo '<a href=?p='.($currpage-1).'>上页</a> '; echo "<a href=?p={$pagecount}>末页</a> "; echo "[{$currpage}/{$pagecount}][共{$recordcount}记录,每页{$pagesize}条]"; ?> <select onchange="location.href='?p='+this.value"> <?php for($i=1;$i<=$pagecount;$i++){?> <option value="<?php echo $i;?>" <?php if($i==$currpage) echo 'selected';?>>第<?php echo $i;?>页</option> <?php }?> </select>
select p_name,p_moshi,p_screen,p_system from phone where `search_in` LIKE '%keyword1%' AND `search_in` LINKE '%keyword2%'