3raser Posted March 22, 2011 Share Posted March 22, 2011 Is it possible to include $_SERVER['REMOTE_ADDR'] in mysql_query("INSERT INTO ips VALUES (null, canitgohere)"); Quote Link to comment https://forums.phpfreaks.com/topic/231346-including-_server-in-mysql/ Share on other sites More sharing options...
jcbones Posted March 22, 2011 Share Posted March 22, 2011 Did you try it? mysql_query("INSERT INTO ips VALUES (null, '{$_SERVER['REMOTE_ADDR']}')"); Quote Link to comment https://forums.phpfreaks.com/topic/231346-including-_server-in-mysql/#findComment-1190668 Share on other sites More sharing options...
3raser Posted March 22, 2011 Author Share Posted March 22, 2011 Thanks for that. I could've swore last time I got an error from something similar to that. But I'll give it a go once more. Quote Link to comment https://forums.phpfreaks.com/topic/231346-including-_server-in-mysql/#findComment-1191055 Share on other sites More sharing options...
darkfreaks Posted March 22, 2011 Share Posted March 22, 2011 using {} escapes the PHP variable in the MYSQL allowing it to process. as well as Putting double quotes inside single quotes then putting dots inside the single quotes like so '"."' Quote Link to comment https://forums.phpfreaks.com/topic/231346-including-_server-in-mysql/#findComment-1191062 Share on other sites More sharing options...
3raser Posted March 23, 2011 Author Share Posted March 23, 2011 Seems the {} didn't work for me, but the double quotes and the periods did. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/231346-including-_server-in-mysql/#findComment-1191117 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.