Microsoft
Software
Hardware
Network
Question : SQL to Insert
I'm running some PHP code and I need to add a new row to table as follows :
FilmID = 1
UserID = 63
Downloaddate = Todays date/time
IPAddress = users current IP address
The Downloaddate is a field type datetime and formats as : 2009-05-13 14:53:28
I'm very new to PHP and mysql so any help would be appreciated. I already have my connection string i.e :
$mysqli = new mysqli("localhost", "user", "password", "dbasename");
Many thanks.
Lee
Answer : SQL to Insert
$ip=$_SERVER['REMOTE_ADDR'
];
$sql = ("INSERT INTO tablename (`FilmID`, `UserID`, `Downloaddate`, `IPAddress`)VALUES('1', '63', NOW(), '$ip')");
$result = mysql_query($sql);
if($result == 'TRUE'){echo "Insert successful";}else{echo "Whoops!";}
Random Solutions
Server 2003 Maximum Boot Partition?
errors during Execute Process Task validation
How can I replace an Entry widget with a Checkbutton one?
usb stick wants drivers after ghosting.
create a rounded corner, outside white, inside transparent, see atttached for example
sound comes out of headphones and not speakers at times
Repeat a handful of keyframes in Flash CS3 Actionscript
AS3 selectable text in a movieClip
Could you help me? ---- Where is the <a rel="nofollow" href="http://www.interland.com?" target="_blank">www.interland.com?</a>
SQL 2005 Mirroring VS SQL 2005 Clustering