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
User not receiving all Exchange mail in Outlook 2007
How do i get hyperlinks to open in a new tab?
Subtract two currency MERGEFIELDs in MS mail merge
Play a specific scene or frame after I used LoadMovie method
Interactive Sorting with drill-down groups collapses group when sorting
DBase IV and Unexpected Error
Making Network connections (to Windows and Linux 'shares') persistent between reboots
Emprex camera DSC3380S to work under Linux FC4, possible?
Access Query - how to manipulate date in format yyyymm
need a step by step on how to setup Reverse DNS for Exchange mail server.