要看你沒(méi)有人選是用什么表示,如果列名為“是否有人選”0表示沒(méi)有人選的話,selcet 課程編號(hào),課程名稱 from 表名 where 是否有人選=0
創(chuàng)新互聯(lián)公司是專業(yè)的安居網(wǎng)站建設(shè)公司,安居接單;提供成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、外貿(mào)網(wǎng)站建設(shè),網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行安居網(wǎng)站開(kāi)發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛(ài)的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!
select c.cno,cname from course c left join sc on(c.cno=sc.cno) where sc.sno=null; 嘻嘻,應(yīng)該是這樣的
$rs = $db-query($sql); // 取得數(shù)據(jù)集
foreach($r = $rs-fetch_array()){ // 遍歷數(shù)據(jù)集
echo($r[5]); // 顯示第五列
} //循環(huán)結(jié)束
再看不懂就貼你的代碼,直接幫你改
這個(gè)簡(jiǎn)單?。∈醉?yè)做個(gè)前臺(tái)輸入姓名和會(huì)員卡信息的頁(yè)面,我做個(gè)簡(jiǎn)單的頁(yè)面給你看
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "html xmlns="headmeta http-equiv="Content-Type" content="text/html; charset=utf-8" /title會(huì)員查詢系統(tǒng)/title/head bodyform id="form1" name="form1" method="post" action="test.php" p label for="name"/label input type="text" name="name" id="name" / /p p label for="vipid"/label input type="text" name="vipid" id="vipid" / /p p input type="submit" name="button" id="button" value="查詢" / /p/form/body/html然后我給你一個(gè)test.php的文件代碼:?php$name = trim($_POST['name']);$vipid = trim($_POST['vipid']);$con = mysql_connect("127.0.0.1","數(shù)據(jù)庫(kù)用戶名","數(shù)據(jù)庫(kù)密碼");if (!$con) { die('Could not connect: ' . mysql_error()); }$a = mysql_select_db("數(shù)據(jù)庫(kù)名字", $con);$sql = "select * from kh_customer where name = '$name' and vipid = '$vipid'";$result = mysql_query($sql);while($row = mysql_fetch_array($result)) { echo $row['name'] . " " . $row['data']; echo "br /"; }mysql_close($con);?
查看一下代碼:
?php
//?獲取表單提交值
$student_id?=?intval(trim($_POST['student_id']));
//?頁(yè)面表單??可以放單獨(dú)的html文件中,如果放單獨(dú)的html頁(yè)面中?form?的action的地址要改成下面的PHP文件名
echo?'form?action=""?method="post"
input?type="text"?name="student_id"?value="{$student_id}"/
input?type="submit"?name="submit"?value="查詢"/
/form';
//?當(dāng)有數(shù)據(jù)提交時(shí)
if?($student_id)
{
$con=?mysql_connect("localhost","root","111")?or?die("連接錯(cuò)誤");
mysql_select_db("examination",$con);
//?查詢
$sql?=?"SELECT?*?FROM?tablename?WHERE?student_id?=?$student_id?";
$res=mysql_query($sql);
$row=mysql_fetch_array($res);
//?輸出
echo?'學(xué)號(hào):'.$row['student_id'].'br姓名:'.$row['name'].'br性別:'.$row['gender'].'br分?jǐn)?shù):'.$row['score'];
}
?