用該列的字段名即可,select語句的通用形式如下:
創(chuàng)新互聯(lián)公司-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比京山網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式京山網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務覆蓋京山地區(qū)。費用合理售后完善,十余年實體公司更值得信賴。
select 你要的信息
from 數(shù)據(jù)表(一個或多個)
where 滿足的條件
所以你的sql語句為:
select 要取得列名 from 表名 where 1
例子
SELECT id FROM `article` where 1
在生成的表單元素以及之前的元素的名字加上中括號即可實現(xiàn)
比如: name="contents" = name="contents[]",最后提交獲取到的數(shù)據(jù)是一個數(shù)組形式的。
代碼如下:
form name="form1" method="post" action="index.php?action=ok"
1.input type="text" name="contents[]" value=""
2.input type="text" name="contents[]" value=""
3.input type="text" name="contents[]" value=""
input type="submit" value="提交"
/form
?php
if($_GET['action'] == 'ok'){
$contents = $_POST['contents'];
print_r($contents);
}
?
得到的數(shù)據(jù)是數(shù)組形式的,遍歷即可。
我直接在這給你修改答案算了
使用的時候刪除行號
修改數(shù)據(jù)庫配置
如果想使用
頁面不刷新查詢數(shù)據(jù)庫
需要使用JQUERY
如果有需要給我留言
1
?php
2
if(isset($_POST['submit'])$_POST['submit']=='提交'){
3
//判斷是否是提交過來的
4
$intext
=
$_POST['intext'];
5
if($intext!=null||$intext!=''){
6
$link
=
mysql_connect("localhost",
"root",
"123456");
7
//數(shù)據(jù)庫配置信息
第一個參數(shù)數(shù)據(jù)庫位置第二個是用戶名第三個是密碼
8
mysql_select_db("szn_test");
9
//設(shè)置要使用的數(shù)據(jù)庫
10
$sql
=
"select
*
from
demo
where
res
=
'".$intext."'";
11
//SQL語句
12
var_dump($sql);
13
$res
=
mysql_query($sql);
14
$arr
=
array();
15
//吧結(jié)果存入數(shù)組
并記錄數(shù)組長度
16
$count
=
0;
17
while($data
=
mysql_fetch_array($res)){
18
$arr[$count]
=
$data;
19
$count++;
20
}
21
//關(guān)閉數(shù)據(jù)庫
22
mysql_close($link);
23
}
24
}
25
26
?
27
html
28
head
29
title/title
30
/head
31
body
32
form
id="form1"
method="post"
action="demo.php"
33
input
type="text"
name="intext"
34
input
type="submit"
name="submit"
value="提交"
35
/form
36
?php
37
if(isset($arr)$arr
!=
null){
38
for($i
=
0;
$i
$count;
$i++){
39
foreach($arr[$i]
as
$key
=
$value){
40
echo
"key:".$key."
value:".$value;
41
echo
"
";
42
}
43
echo
"br";
44
}
45
}
46
?
47
/body
48
/html
這個是數(shù)據(jù)庫查詢代碼
你可以看以下對照著修改修改
新聞標題:php獲取數(shù)據(jù)表條數(shù)據(jù) php獲取參數(shù)值的三種方式
文章地址:http://muchs.cn/article44/doeghee.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營銷型網(wǎng)站建設(shè)、定制網(wǎng)站、網(wǎng)站排名、外貿(mào)建站、商城網(wǎng)站、搜索引擎優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)