在MySQL插入语句中使用php变量 [英] Using php variables inside MySQL insert statement
本文介绍了在MySQL插入语句中使用php变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下语句,但不确定如何正确获取语句内的$variables
:
I'm using the following statement, but not sure how to get the $variables
inside the statement properly:
mysql_query("INSERT INTO subscribers (email, referral_id, user_id, ip_address)
VALUES ('$user_email', '$user_refer', '$user_share', '$_SERVER['REMOTE_ADDR']')");
推荐答案
只需更改最后一个:
mysql_query("INSERT INTO subscribers (email, referral_id, user_id, ip_address)
VALUES ('$user_email', '$user_refer', '$user_share', '".$_SERVER['REMOTE_ADDR']."')");
这篇关于在MySQL插入语句中使用php变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文