Jump to content


Photo

SQL field update


  • Please log in to reply
6 replies to this topic

#1 asgsoft

asgsoft
  • Members
  • PipPipPip
  • Advanced Member
  • 56 posts

Posted 03 May 2006 - 04:04 PM

I have this PHP script:

<?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");
?>

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?

Free SEO and Domain tools |HTML ENT| Your Source to expired domains with PageRank & tips


#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 03 May 2006 - 04:40 PM

when you put values instead of variables for what?
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 asgsoft

asgsoft
  • Members
  • PipPipPip
  • Advanced Member
  • 56 posts

Posted 03 May 2006 - 04:53 PM

sorry forgot to mention I was changing the variables of the SQL query.

Free SEO and Domain tools |HTML ENT| Your Source to expired domains with PageRank & tips


#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 03 May 2006 - 04:58 PM

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.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#5 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 03 May 2006 - 05:09 PM

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?

Info: PHP Manual


#6 asgsoft

asgsoft
  • Members
  • PipPipPip
  • Advanced Member
  • 56 posts

Posted 03 May 2006 - 06:56 PM

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

Free SEO and Domain tools |HTML ENT| Your Source to expired domains with PageRank & tips


#7 philo23

philo23
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 03 May 2006 - 07:13 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users