Smudly Posted June 10, 2010 Share Posted June 10, 2010 I am trying to capture the current date a user is on my website, but only when they click on a particular link (in this case, surf.php). <?php $surf = $_GET['surf']; if ($_SESSION['username'] != 'Admin') echo "Welcome, ".$_SESSION['username']. "!<br /><a href='surf.php' name='surf'>Surf</a><br /><a href='sites.php'>Add Site</a><br /><a href='logout.php'>Logout</a>"; if ($surf){ include('inc/connect.php'); $lastsurfed = date("Y-m-d"); $currentdate = mysql_query("SELECT lastsurfed FROM users WHERE lastsurfed='$lastsurfed'"); $datecount = mysql_num_rows($datecount); } else echo "Welcome, ".$_SESSION['username']. "!<br /><a href='surf.php'>Surf</a><br /><a href='sites.php'>Add Site</a><br /><a href='logout.php'>Logout</a><br /><a href='admin/index.php'>Admin Area</a>"; } else header("Location: index.php"); ?> I must be doing something wrong. No errors are being returned. When clicking the link, it does not update the date inside my sql taable. Link to comment https://forums.phpfreaks.com/topic/204439-capturing-date-user-last-clicks-a-link/ Share on other sites More sharing options...
thomashw Posted June 10, 2010 Share Posted June 10, 2010 Using a SELECT takes the information FROM your database. You need to use an INSERT INTO statement. http://www.w3schools.com/PHP/php_mysql_insert.asp Link to comment https://forums.phpfreaks.com/topic/204439-capturing-date-user-last-clicks-a-link/#findComment-1070587 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.