且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我通过php将值插入MySQL时遇到问题

更新时间:2022-10-31 11:03:39

mxitid =


_SERVER [ HTTP_X_MXIT_USERID_R];





我要导入的我的数据库通过





  


sql = INSERT INTO


Hi Im having some trouble implementing info into a database

I got the line

$mxitid = $_SERVER["HTTP_X_MXIT_USERID_R"];



Which I'm importing to my database via


$sql = "INSERT INTO ".$dbTable." (StringyChat_ip,StringyChat_name,StringyChat_message,StringyChat_time,mxit_id) VALUES (\"$ip\",\"$name\",\"$message\",$post_time,$mxitid)";
                  $result = mysql_query($sql);



well its working perfectly, but the problem I'm experiencing is that if my value

$_SERVER["HTTP_X_MXIT_USERID_R"]

cannot be retrieved I can't insert any info to my database.

the

$_SERVER["HTTP_X_MXIT_USERID_R"]

is being used via a specific platform called mxit, so if I use any other platform it don't work. Is there maybe a way to change the line

$mxitid = $_SERVER["HTTP_X_MXIT_USERID_R"];

to a function if the info couldn't be retrieved to insert another default value like ADMIN rather in the place of it?

mxitid =


_SERVER["HTTP_X_MXIT_USERID_R"];



Which I'm importing to my database via



sql = "INSERT INTO ".