数据库问题 [英] Database Issue

查看:69
本文介绍了数据库问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码,当按下提交按钮时,它将在数据库中创建一个新记录,但不会将表单中的任何数据放入新记录中。我很难过。


这就是我拉页面时http链接的样子。


[html]

/mailsend.php?iid=1

[/ html]


这告诉以下代码我要向哪个人发送消息。


[php]

< ;?

include(''db.php'');

if($ myID == 0)header(" location:login.php");

if($ admin == 0)header(" location:login.php") ;


包括(navtop.php);

包括(nav.php);

包括(func.php);

connect1();



//这是我获取数据的地方并将其插入数据库

_v(''mode; i:id'');

if($ mode ==''save''){<

pg(''msg_from,msg_to,msg_body,msg_date,msg_time,msg _subject,msg_subject,msg_isread,msg_sid,msg_tid'');

$ qupd = mysql_query(" INSERT INTO`email` VAL UES(''0'','$ name'',''$ to'',''$ msg'',''$ now'',''$ t'',''$ subject'', ''0'',''$ myId'',''$ iid'')")或者死(mysql_error());

goto(''mail.php'');

}


$ now = date(''m / d / Y'');

$ t = date( ''h:我是'');



//这是获取当前用户和当前数据的查询
< br $>
$ query = mysql_query(" SELECT * FROM`instructors` WHERE id =''$ myID''")或die(mysql_error());

$ row = mysql_fetch_array($ query);

extract($ row);

$ name = $ row [''first_name'']。 " " 。 $ row [''last_name''];


echo"< td width = 100%valign = top>

< table border = 0 width = 100%class = leftMenutop1>< td>


< / form>

< form method =''post' 'name =''frmado''action =''mailsend.php''>

< table border = 0 width = 99%cellpadding = 0 cellspacing = 0>

< Td wdith = 100%>" ;;


//这是将所选人员从列表中拉出数据库的查询

//这个数据在页面上显示得很好


$ qi = mysql_query(" SELECT * FROM`instructors` WHERE id =''$ iid''");

$ Row2 = mysql_fetch_array($ qi);

extract($ row);

$ to = $ row2 [''first_name'' ]。 " " 。 $ row2 [''last_name''];

echo"


< p>< br>< p>< span class = ''text''>来自:< b> $ name< / b>< / p>


< p>< span class =''text'' >收件人:< b> $ first_name $ last_name< / b>< / p>


< p>< span class =''text' '>主题< br>

< input type =''text''size ='''50''name =''subject''value =''''id =''subject ''/>

< / p>


< p>< span class =''text''>输入消息< br> ;

< textarea name =''msg''id =''msg''cols = 50行= 15 value =''''>< / textarea>


< input type =''hidden''name =''mode''value =''save''>

< p>< input type = submit name =''submit''value =''发送消息''class =''input''>< / p>


< / td>

< / table>" ;;


include(''navbot.php'');


?>

[/ php]

I have this code and I when the submit button is pressed it will create a new record in the database but wont place any of the data from the form into the new record.? Im kind stumped.

This is what the http link looks like when I pull the page up.

[html]
/mailsend.php?iid=1
[/html]

This tells the following code which person I am sending a message to.

[php]
<?
include(''db.php'');
if ($myID == 0) header("location:login.php");
if ($admin == 0) header("location:login.php");

include("navtop.php");
include("nav.php");
include("func.php");
connect1();



// this is where I take the data and insert it into the database
_v(''mode;i:id'');
if ($mode==''save''){
pg(''msg_from,msg_to,msg_body,msg_date,msg_time,msg _subject,msg_subject,msg_isread,msg_sid,msg_tid'');
$qupd = mysql_query("INSERT INTO `email` VALUES (''0'',''$name'', ''$to'', ''$msg'', ''$now'', ''$t'', ''$subject'',''0'',''$myId'',''$iid'')") or die(mysql_error());
goto(''mail.php'');
}

$now = date(''m/d/Y'');
$t = date(''h:i A'');


// this is the query that gets the current loged in user and data about him or her

$query = mysql_query("SELECT * FROM `instructors` WHERE id=''$myID''") or die(mysql_error());
$row = mysql_fetch_array($query);
extract($row);
$name = $row[''first_name''] . " " . $row[''last_name''];


echo "<td width=100% valign=top>
<table border=0 width=100% class=leftMenutop1><td>

</form>
<form method=''post'' name=''frmado'' action=''mailsend.php''>
<table border=0 width=99% cellpadding=0 cellspacing=0>
<Td wdith=100%>";

// this is the query that pulls the selected person from the list out of the database
// this data displays just fine on the page

$qi = mysql_query("SELECT * FROM `instructors` WHERE id=''$iid''");
$Row2 = mysql_fetch_array($qi);
extract($row);
$to = $row2[''first_name''] . " " . $row2[''last_name''];
echo "

<p><br><p><span class=''text''>From: <b>$name</b></p>

<p><span class=''text''>To: <b>$first_name $last_name</b></p>


<p><span class=''text''>Subject<br>
<input type=''text'' size=''50'' name=''subject'' value='''' id=''subject'' />
</p>

<p><span class=''text''>Enter Message<br>
<textarea name=''msg'' id=''msg'' cols=50 rows=15 value=''''></textarea>

<input type=''hidden'' name=''mode'' value=''save''>
<p><input type=submit name=''submit'' value=''Send Message'' class=''input'' ></p>


</td>
</table>";

include(''navbot.php'');

?>
[/php]

推荐答案

myID == 0)标题( " location:login.php");

if(
myID == 0) header("location:login.php");
if (


admin == 0)header(" location:login.php");


include(navtop.php);

include(nav.php);

include(") func.php");

connect1();



//这是我获取数据并插入数据的地方进入数据库

_v(''mode; i:id'');

if(
admin == 0) header("location:login.php");

include("navtop.php");
include("nav.php");
include("func.php");
connect1();



// this is where I take the data and insert it into the database
_v(''mode;i:id'');
if (


mode ==''保存''){

pg(''msg_from,msg_to,msg_body,msg_date,msg_time,msg _subject,msg_subject,msg_isread,msg_sid,msg_tid'');
mode==''save''){
pg(''msg_from,msg_to,msg_body,msg_date,msg_time,msg _subject,msg_subject,msg_isread,msg_sid,msg_tid'');


这篇关于数据库问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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