Spoke too soon...
Being my second day programming in over three years, I'm a little lost at this point.
I'm starting on my first function and I know this code is just HORRIBLY written up to this point, to which I am sorry. 🙁
My main concern is the function 'clickcount' and how it would interact with the link at the lower end of the code. I can't get the click value to increment and I'm not sure if the link doesn't recognize the call or if the function is written incorrectly.
I'm still a little shady on the syntax of things, so I expect plenty of nodding heads when people look at this code.
<?php require_once('Connections/senior.php'); ?>
<?php
function clickcount($x, $y, $z)
{
mysql_query("UPDATE $x SET $y = $y + 1 WHERE linkName= '$z'");
}
?>
<?
/* declare some relevant variables */
$hostname = "localhost";
$username = "root";
$password = "********";
$userstable = "names";
$tableLinks = "links";
$dbName = "senior";
/* make connection to database */
MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database");
@mysql_select_db( "$dbName") or die( "Unable to select database");
$query = "SELECT views FROM $tableLinks WHERE linkType = 'main'";
$result = MYSQL_QUERY($query);
$views = mysql_result($result,$i,"views");
$views=$views+1;
mysql_query("UPDATE $tableLinks SET views = '$views' WHERE linkType = 'main'");
PRINT "This form of navigation has been viewed ";
PRINT "$views";
PRINT " times";
PRINT "<BR><BR>";
$queryV = "SELECT views FROM $userstable WHERE linkName = 'cats'";
$queryC = "SELECT clicks FROM $userstable WHERE linkName = 'cats'";
$resultV = MYSQL_QUERY($queryV);
$resultC = MYSQL_QUERY($queryC);
$views = mysql_result($resultV,$i,"views");
$clicks = mysql_result($resultC,$i,"clicks");
$views=$views+1;
mysql_query("UPDATE $userstable SET views = '$views' WHERE linkName = 'cats'");
PRINT "This page has been accessed or reloaded ";
PRINT "$views";
PRINT " times";
PRINT "<BR><BR>";
PRINT "This system won't work however since the counter is not tracking from what link this page was accessed from";
PRINT "<BR><BR>";
PRINT "However, this could be a rudamentry system for setting a heirarchy within each separate type of navigation.";
PRINT "<BR><BR>";
PRINT "Clicks = $clicks";
PRINT "<BR><BR>";
?>
<a href="cats.php" OnClick="clickcount($usertable, $clicks, cats)";>clik me</a>
</html>
<?php
?>
Thank you to anyone willing to help any little bit at all.