I'm *trying* to use the following code (link.php) to update a column in my db to count clicks to external links:
Quote:
<?php
/** Connect to DB */
mysqli_connect("localhost", "user", "pass", "db") or die(mysqli_error());
$link = $_GET['ID'];
/** Increase the counter of the URL to which the user is going*/
mysqli_query("UPDATE Directory SET Clicks = count + 1 WHERE ID = $link") or die(mysql_error());
/** Retrieves URL */
$result = mysqli_query("SELECT * FROM Directory WHERE ID = ID") or die(mysqli_error());
$row = mysqli_fetch_array($result);
//redirects them to the link they clicked
header( "Location:" .$row['Website'] );
?>
|
But its telling me that my query is incorrect, I thought I only had to update the count into the 'Clicks' column in the database?
The link.php page is just opening, with no redirect.
Do I need to do something else with the query or the database column to make this work?
