Jump to content

Archived

This topic is now archived and is closed to further replies.

asgsoft

SQL field update

Recommended Posts

I have this PHP script:

[code]
<?php
include 'config.php';
mysql_connect("$host", "$user", "$pass") or die(mysql_error());
mysql_select_db("$dbname") or die(mysql_error());

$outurl = $_GET['url'];
mysql_query("UPDATE `banner` SET `clicks` = (clicks+1) WHERE `link` = '$outurl'");

header("Location: $outurl");
?> [/code]

It works on Localhost and also my sites phpmyadmin when I put values instead of the variables but when I try if from the site it doesn't update the table but it stays 0.

How can I fix that?

Share this post


Link to post
Share on other sites
sorry forgot to mention I was changing the variables of the SQL query.

Share this post


Link to post
Share on other sites
give an example of what you are trying to do.

mysql_query("UPDATE `banner` SET `clicks` = '10' WHERE `link` = '$outurl'");

would set clicks to 10, for instance.

Share this post


Link to post
Share on other sites
When you say it works on your localhost, you mean it works without the variables or with them?

What is the difference in versions between your development version and the main server version where it fails?

Share this post


Link to post
Share on other sites
On localhost it works with variables.

On the server it works on phpmyadmin

My localhost server has version 5.0.18-nt and webhosting server has version 4.1.18-standard-log

Share this post


Link to post
Share on other sites
if the script is running on your localhost and not aswell then try changing the localhost variable to the mysql host of your server, ask your server admin if you dont know the host.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.