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)"); 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']}')"); 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. 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 '"."' 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! Link to comment https://forums.phpfreaks.com/topic/231346-including-_server-in-mysql/#findComment-1191117 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.