EternalSorrow Posted September 20, 2009 Share Posted September 20, 2009 I'm currently working on constructing a "counter page" which will update clicks for a link and reroute the visitor to the appropriate series page, but I've hit a snag. I want to use the series as the identifier for the counter page, and I use the correct link for the series, such as: <a href="counter.php?series='.$series.'">'.$series.'</a> but when the link is clicked I'm sent to an empty counter page. Apparently the counter php code isn't properly reading the series name and updating the information, but I can't figure out what the problem is because no mysql error message appears. So does anyone know what may be causing the problem in using a name to update the database hit counter and reroute visitors to the appropriate page? Here's the full code for the counter.php page: <?php mysql_connect(localhost,'name','pw'); @mysql_select_db(db) or die( "Unable to select database"); if(!isset($_GET['series']) || empty($_GET['series']) || !is_numeric($_GET['series'])) { die(mysql_error()); } else { $series=$_GET['series']; $query=mysql_query("SELECT series, count FROM series WHERE series='$series") or die(mysql_error()); if(mysql_numrows($query) == "0") { die(mysql_error()); } else { while($r=mysql_fetch_array($query)) { $clicks=$r[count]; $clicks++; mysql_query("UPDATE series SET count='$clicks' WHERE series='$r[series]'") or die(mysql_error()); header("Location: about.php?series=$r[series]"); } } } ?> Link to comment https://forums.phpfreaks.com/topic/174912-counter-use-of-names/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.