Hi again!
Well Im slowly but surely working my way through this PHP and loving every minute however Im now trying to mix PHP with Javascript and hitting problems. Basically I have a PHP created page containing approx 40 external page links, what I need to do is update a counter in the table containing the details of the item they clicked.
eg
table - People (ID, Name, Link, Counter)
the 40 people are then listed in a table and if the user clicks the link they go to that persons page, what I want to do is update users Counter every time someone clicks their link (ie a referred to count). The way Id seen it would be to have an On_Click Javascript event which would then include a line of PHP to select the correct row in the table and update the counter eg
Im playing around with it but not having any joy, now Im hearing that you cant really embed php within Javascript which would explain a lot!
Does anyone have any ideas? Im sure this is pretty standard coding as per all those pay per click links etc.
Well Im slowly but surely working my way through this PHP and loving every minute however Im now trying to mix PHP with Javascript and hitting problems. Basically I have a PHP created page containing approx 40 external page links, what I need to do is update a counter in the table containing the details of the item they clicked.
eg
table - People (ID, Name, Link, Counter)
the 40 people are then listed in a table and if the user clicks the link they go to that persons page, what I want to do is update users Counter every time someone clicks their link (ie a referred to count). The way Id seen it would be to have an On_Click Javascript event which would then include a line of PHP to select the correct row in the table and update the counter eg
Code:
<script language="JavaScript">
Function UpdateLinkCounter() {
<?php mysql_query('UPDATE `people` SET `counter` = `counter`++ WHERE CONCAT(`ID`) = $ID; ?>
.....the Javascript to goto the correct link.
}
Im playing around with it but not having any joy, now Im hearing that you cant really embed php within Javascript which would explain a lot!
Does anyone have any ideas? Im sure this is pretty standard coding as per all those pay per click links etc.