一,关于我们子页面如何通过两表联查弄出以下效果,
<?php
require_once(dirname(__FILE__).'/include/config.inc.php');
//初始化参数检测正确性
$cid = empty($cid) ? 2 : intval($cid);
$id = empty($id) ? 0 : intval($id);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php echo GetHeader(1,$cid); ?>
<link href="templates/default/style/webstyle.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" href="css/aboutUS-honnor.css" type="text/css" />
<script type="text/javascript" src="templates/default/js/jquery.min.js"></script>
<script type="text/javascript" src="templates/default/js/top.js"></script>
</head>
<body>
<div class="into">
<!-- header-->
<?php require_once('header.php'); ?>
<!-- /header-->
<div class="header-banner">
<img src="images/15.jpg" alt="">
</div>
<div class="main">
<div class="mode-title">
<p>关于我们</p>
</div>
<div class="mode-adress">
<p>你当前所在的位置:首页>关于我们</p>
</div>
<div class="about">
<h2>关于我们</h2>
</div>
<div class="titles">
<h2>关于我们/about US</h2>
</div>
<div class="column">
<ul>
<!-- <?php $dosql->Execute("SELECT * FROM `#@__info`,`#@__infoclass`WHERE `#@__infoclass`.parentid=2 and `#@__info`.classid=`#@__infoclass`.id");
while($row = $dosql->GetArray())
//获取链接地址
if($row['linkurl']=='' and $cfg_isreurl!='Y')
$gourl = 'about.php?cid='.$cid.'&id='.$row['id'];
else if($cfg_isreurl=='Y')
$gourl = 'about-'.$cid.'-'.$row['id'].'-1.html';
else
$gourl = $row['linkurl'];
?> -->
<?php
$dosql->Execute("SELECT * FROM `#@__info`,`#@__infoclass`WHERE `#@__infoclass`.parentid=2 and `#@__info`.classid=`#@__infoclass`.id");
while($row = $dosql->GetArray())
{
//获取链接地址
if($row['linkurl']=='' and $cfg_isreurl!='Y')
$gourl = 'about.php?cid='.$cid.'&id='.$row['id'];
else if($cfg_isreurl=='Y')
$gourl = 'about-'.$cid.'-'.$row['id'].'-1.html';
else
$gourl = $row['linkurl'];
?>
<li><a href="<?php echo $gourl;?>"><?php echo $row['classname'];?></a></li>
<?php
}
?>
</ul>
</div>
<div class="text">
<?php
if (empty($id)){
$row=$dosql->GetOne("SELECT* FROM `#@__info` where classid=16");
}else{
$row=$dosql->GetOne("SELECT* FROM `#@__info` where classid=$id");
}
?>
<p><?php echo $row['content'];?></p>
<!-- -->
</div>
</div>
<!-- footer开始 -->
<?php require_once('footer.php'); ?>
<!-- footer结束 -->
</body>
</html>
刚开始做关于我们的时候有些不懂效果究竟是怎么弄出来的,后面老师一讲解,知道要用数据库进行两表联查,才能达到效果。
二.获取多条与获取一条之间的差别
获取一条:getone $row = $dosql->GetOne("SELECT * FROM `#@__infolist` WHERE classid=4 AND flag LIKE '%h%' AND delstate='' AND checkinfo=true ORDER BY orderid DESC");
if(isset($row['id']))
{
//获取链接地址
if($row['linkurl']=='' and $cfg_isreurl!='Y')
$gourl = 'newsshow.php?cid='.$row['classid'].'&id='.$row['id'];
else if($cfg_isreurl=='Y')
$gourl = 'newsshow-'.$row['classid'].'-'.$row['id'].'-1.html';
else
$gourl = $row['linkurl'];
获取多条:GetArray
<?php $dosql->Execute("SELECT * FROM `#@__infolist` WHERE classid=4 AND delstate='' and flag like '%a%' AND checkinfo=true ORDER BY orderid ASC LIMIT 0,3 ");
while($row = $dosql->GetArray())
{
//获取链接地址
if($row['linkurl']=='' and $cfg_isreurl!='Y')
$gourl = 'newsshow.php?cid='.$row['classid'].'&id='.$row['id'];
else if($cfg_isreurl=='Y')
$gourl = 'newsshow-'.$row['classid'].'-'.$row['id'].'-1.html';
else
$gourl = $row['linkurl'];
if($row['picurl']!='')
$picurl = $row['picurl'];
else
$picurl = 'templates/default/images/nofoundpic.gif';
?>
二php安装环境遇到问题解决
1、是否打开了PHPstudy,
(当Apache不能启用时,考虑端口是否被占用;解决方法:打开phpstudy->其他选项菜单->phpstudy设置->端口常规设置,更改httpd端
口里 的数值,点击应用,重新打开phpstudy),访问安装或登录的页面网址改为http://localhost:更改的数值/phpMyWind/install/
2、是否将phpMyWind文件放错了位置
(解决方法:打开phpstudy->其他选项菜单->网站根目录,重新粘贴一下phpMyWind文件)
3、头次安装,不出现安装页面
(请删除phpMyWind/data文件夹下install_lock.txt文件,再重新进入安装网址)