JShor
08-27-2007, 08:42 PM
Hi, I am trying to make a code (which is a mix of Jscript and PHP) where when a person clicks on a link, it inserts the amount of recorded clicks into mysql...the code looks like this:
<?php
$query = "INSERT INTO clicks (click, date) VALUES('$click', '$date') ");
echo "<script type='text/javascript'>";
echo "function clicks(){"
mysql_query( $query );
echo "}";
echo "</script>";
?>
And here is an example hyperlink code:
<a href="click.php?url=http://www.google.com" onClick="clicks()">Google.com</a>
But it isn't inserting the data into mysql. Why is this not working? :?
<?php
$query = "INSERT INTO clicks (click, date) VALUES('$click', '$date') ");
echo "<script type='text/javascript'>";
echo "function clicks(){"
mysql_query( $query );
echo "}";
echo "</script>";
?>
And here is an example hyperlink code:
<a href="click.php?url=http://www.google.com" onClick="clicks()">Google.com</a>
But it isn't inserting the data into mysql. Why is this not working? :?