我的代码出了什么问题?我试图将数据插入两个表。请帮忙 [英] what is wrong on my codes? im trying to insert data into two tables. please help
问题描述
我试图将数据插入两个表格,我的代码有什么问题,请帮忙。
if(isset( $ _SESSION ['用户名']))
{
$ form = true;
$ oreqtype ='';
$ orecip ='';
$ omessage ='';
if(isset($ _ POST ['reqtype'] ,$ _POST ['recip'],$ _POST ['message']))
{
$ oreqtype = $ _POST ['reqtype'];
$ orecip = $ _POST ['recip'];
$ omessage = $ _POST ['message'];
//我们删除斜杠取决于配置
if(get_magic_quotes_gpc())
{
$ oreqtype = stripslashes($ oreqtype);
$ orecip = stripslashes($ orecip);
$ omessage = stripslashes($ omessage);
}
if($ _ POST ['reqtype']!=''和$ _POST ['recip']!=''和$ _POST ['message']!='')
{
$ req type = mysql_real_escape_string($ reqtype);
$ recip = mysql_real_escape_string($ orecip);
$ message = mysql_real_escape_string(nl2br(htmlentities($ omessage,ENT_QUOTES,'UTF-) 8')));
$ dn1 = mysql_fetch_array(mysql_query('select count(id)as recip,id as recipid, (从pm选择count(*))为来自用户的npm,其中username ='。$ recip。''));
if($ dn1 ['recip'] == 1)
{
if($ dn1 ['recipid']!= $ _ SESSION ['userid'])
{
$ id = $ dn1 ['npm'] + 1;
if(mysql_query('insert into pm(id, id2,reqtype,user1,user2,message,timestamp,user1read,user2read,status)values('。$ id。',1,'。$ title。','。$ _ SESSION ['userid ''。','。$ dn1 ['recipid']。','。$ message。','。time()。',是,否,等待批准)',
插入到itrf(req_id,req_code,req_date,req_status,req_approveuser,req_noteuser,req_datenote,req_receiveuser,rec_datereceived,form_id)
VALUES('。$ id。',2,'。 timestamp。',aa,'。$ dn1 ['recipid']。',,,是,,'。$ id。')'))) />
{
?>
_SESSION ['username']))
{
form = true;
oreqtype ='';
Im trying to insert data into two tables, whats is wrong on my codes, please help.
if(isset($_SESSION['username']))
{
$form = true;
$oreqtype = '';
$orecip = '';
$omessage = '';
if(isset($_POST['reqtype'], $_POST['recip'], $_POST['message']))
{
$oreqtype = $_POST['reqtype'];
$orecip = $_POST['recip'];
$omessage = $_POST['message'];
//We remove slashes depending on the configuration
if(get_magic_quotes_gpc())
{
$oreqtype = stripslashes($oreqtype);
$orecip = stripslashes($orecip);
$omessage = stripslashes($omessage);
}
if($_POST['reqtype']!='' and $_POST['recip']!='' and $_POST['message']!='')
{
$reqtype = mysql_real_escape_string($reqtype);
$recip = mysql_real_escape_string($orecip);
$message = mysql_real_escape_string(nl2br(htmlentities($omessage, ENT_QUOTES, 'UTF-8')));
$dn1 = mysql_fetch_array(mysql_query('select count(id) as recip, id as recipid, (select count(*) from pm) as npm from users where username="'.$recip.'"'));
if($dn1['recip']==1)
{
if($dn1['recipid']!=$_SESSION['userid'])
{
$id = $dn1['npm']+1;
if(mysql_query('insert into pm (id, id2, reqtype, user1, user2, message, timestamp, user1read, user2read, status)values("'.$id.'", "1", "'.$title.'", "'.$_SESSION['userid'].'", "'.$dn1['recipid'].'", "'.$message.'", "'.time().'", "yes", "no", "Waiting for Approval")',
'insert into itrf(req_id, req_code, req_date, req_status, req_approveuser, req_noteuser, req_datenote, req_receiveuser, rec_datereceived, form_id)
VALUES("'.$id.'", "2", "'.timestamp.'","aa", "'.$dn1['recipid'].'", "", "", "Yes","", "'.$id.'")'))
{
?>
_SESSION['username']))
{
form = true;
oreqtype = '';
这篇关于我的代码出了什么问题?我试图将数据插入两个表。请帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!