Dolamite Jenkins
asked on
get time and update row
I'm trying to do 2 things... My code works but I need it to record the time the data is saved so I can see if the data is stale also is there such thing as a insert or replace function or Update because I don't want to generate a new row every time but simply check if a user and group existent and update that row or if it doesn't then create the row... I know I use insert or replace in sqlite how about php --> mysql ?
<?php
$dbhost =xxxx
$dbuser = xxxx
$dbpass = xxxxx;
$dbname=xxxxx;
$con = mysql_connect("$dbhost","$dbuser","$dbpass");
mysql_select_db($dbname);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$sql="INSERT INTO gpscoordinates (UserName, Password1, Group1,Latitude,Longitude)
VALUES
('$_POST[User]','$_POST[Password1]','$_POST[Group1]','$_POST[Latitude]','$_POST[Longitude]')";
//$sql="INSERT INTO gpscoordinates (UserName, Password1, Group1,Latitude,Longitude)
//VALUES ('1','2','3','4','5')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER