AnantLabs / jquery-thesaurus

Automatically exported from code.google.com/p/jquery-thesaurus
0 stars 1 forks source link

ID for different User ore Pages #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I would like to have a separate table in Database to store visits & clicks of 
different Users or Pages using a "id".

I embedded the following in index.html to push the "id" into script:

<script type="text/javascript">id=101;</script>
<script src="http://www.abc.com/thesaurus/jquery.thesaurus.js"></script>

If i would edit the db.php as follows to count clicks and visits also in table 
user, how could i pass the "var id" trough the different scripts to access and 
use it in db.php?

public function incrementClickStat($term) {
mysql_query("UPDATE thesaurus SET clicked=clicked+1 WHERE term LIKE '{$term}'");
mysql_query("UPDATE user SET clicked=clicked+1 WHERE id='{$id}'");
mysql_query("UPDATE user SET clicked=clicked-3");
    }

public function findDefinition($term, $caseSentitive) {
if($caseSentitive) {
result = mysql_query("SELECT term, description FROM thesaurus WHERE 
term='{$term}'");
mysql_query("UPDATE thesaurus SET visited=visited+1 WHERE term='{$term}'");
mysql_query("UPDATE user SET visited=visited+1 WHERE id='{$id}'");
        } else {
$result = mysql_query("SELECT term, description FROM thesaurus WHERE term LIKE 
'{$term}'");
mysql_query("UPDATE thesaurus SET visited=visited+1 WHERE term LIKE '{$term}'");
mysql_query("UPDATE user SET visited=visited+1 WHERE id='{$id}'");

Original issue reported on code.google.com by upps2...@googlemail.com on 12 Feb 2011 at 2:14

GoogleCodeExporter commented 9 years ago
This is more a feature request, then a defect

Original comment by felix.os...@gmail.com on 9 Mar 2012 at 1:35