I have the following code:
<?php
$db = "register";
$link = mysql_connect( "localhost:/users/rupertbj/domains/rupstar.co.uk/sql/mysql.sock", "root" );
if ( !$link ) die( "Couldn't connect to MySQL" );
mysql_select_db( $db, $link ) or die( "Couldn't open $db: ".mysql_error() );
$sql = "INSERT INTO userTable VALUES ( '$user', now() )";
mysql_query( $sql, $link );
mysql_close( $link );
}
?>
however - I need to check for the existence of an entry ($user) and if it exists update the datetime; and if it doesn't exist add a new entry.
how do i need to modify my code?
many thanks in advance