php / sql返回空集 [英] php/sql returning empty set

查看:75
本文介绍了php / sql返回空集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< html>

< head>

< / head>

< body> ;

< form action =insertform.phpmethod =post>

字段:< input type =textname =fielda> ;

field2:< input type =textname =fieldb>

thedata:< input type =textname =qdata> ;

< input type =submitname =submit>

< / form>



if(isset($ _ POST ['submit'])){



$ con = mysql_connect(localhost,user,password) ;

if(!$ con){

die(无法连接.mysql_error());

}

mysql_select_db(stQutieria,$ con);

$ sql =INSERT INTO qtable(fielda,fieldb,qdata)VALUES($ _POST [fielda],$ _ POST [fieldb] ],$ _ POST [qdata]);



mysql_query($ sql,$ con);

mysql_close($ con );

}

?>

< / body>

< / html>



我试图在MySQL的数据库中的qtable表中分配值。

解决方案

_POST ['submit'])){



con = mysql_connect(localhost,user,password);

if(!


< blockquote> con){

die(无法连接。 mysql_error());

}

mysql_select_db(stQutieria,


<html>
<head>
</head>
<body>
<form action = "insertform.php" method = "post">
field: <input type = "text" name = "fielda">
field2: <input type = "text" name = "fieldb">
thedata: <input type = "text" name = "qdata">
<input type = "submit" name = "submit">
</form>

if (isset($_POST['submit'])){

$con = mysql_connect("localhost","user","password");
if (!$con){
die("cannot connect" . mysql_error());
}
mysql_select_db("stQutieria",$con);
$sql = "INSERT INTO qtable(fielda, fieldb, qdata) VALUES ("$_POST[fielda]","$_POST[fieldb]","$_POST[qdata]")";

mysql_query($sql,$con);
mysql_close($con);
}
?>
</body>
</html>

Am trying to assign values in my qtable table in database in MySQL.

解决方案

_POST['submit'])){


con = mysql_connect("localhost","user","password");
if (!


con){
die("cannot connect" . mysql_error());
}
mysql_select_db("stQutieria",


这篇关于php / sql返回空集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆