Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 08-08-2022, 08:58 PM   #1
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,116
One more quick question, click counting

I'm *trying* to use the following code (link.php) to update a column in my db to count clicks to external links:

Quote:
<?php

/** Connect to DB */

mysqli_connect("localhost", "user", "pass", "db") or die(mysqli_error());

$link = $_GET['ID'];

/** Increase the counter of the URL to which the user is going*/

mysqli_query("UPDATE Directory SET Clicks = count + 1 WHERE ID = $link") or die(mysql_error());

/** Retrieves URL */

$result = mysqli_query("SELECT * FROM Directory WHERE ID = ID") or die(mysqli_error());

$row = mysqli_fetch_array($result);

//redirects them to the link they clicked
header( "Location:" .$row['Website'] );

?>
But its telling me that my query is incorrect, I thought I only had to update the count into the 'Clicks' column in the database?

The link.php page is just opening, with no redirect.

Do I need to do something else with the query or the database column to make this work?
__________________
NOTHING TO SEE HERE
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-08-2022, 10:58 PM   #2
LaSexorcisto
Confirmed User
 
LaSexorcisto's Avatar
 
Industry Role:
Join Date: Mar 2022
Location: In the moment
Posts: 95
This is how PHP got labeled as a shitty unsecured language that's easy to hack. I've been defending the language for 15+ years saying its not the language that's bad.
LaSexorcisto is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-08-2022, 11:58 PM   #3
Klen
 
Klen's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Little Vienna
Posts: 32,235
Did you tested first query in database over tool like phpmyadmin ?
Klen is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-09-2022, 12:18 AM   #4
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
Ignoring all the SQL injection etc,

UPDATE Directory SET Clicks = count + 1 WHERE ID = '$link'
should be
UPDATE Directory SET Clicks = Clicks + 1 WHERE ID = '$link'
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
column, count, query, database, update, clicks, link.php, helpme, page, redirect, code, counting, click, quick, question, incorrect, telling, external, links



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.