SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member Nicholas Brown's Avatar
    Join Date
    Mar 2001
    Location
    UK
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <figured it out - im a fool >
    Last edited by Nicholas Brown; Jul 20, 2001 at 13:10.

  2. #2
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "$d->hits" <= not really sure what that is doing??

    if the field 'hits' is only ever going to hold numeric data - change the type to INT(7) then your query would look like this

    mysql_query("UPDATE affiliates SET hits=hits+1 WHERE username='$username'");

  3. #3
    SitePoint Member Nicholas Brown's Avatar
    Join Date
    Mar 2001
    Location
    UK
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tanx
    Nicholas Brown
    Twilight-Online.net - Virtual/Dedicated non-VDI Hosting.

  4. #4
    SitePoint Member Nicholas Brown's Avatar
    Join Date
    Mar 2001
    Location
    UK
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <figured it out - im a fool >
    Last edited by Nicholas Brown; Jul 20, 2001 at 13:12.
    Nicholas Brown
    Twilight-Online.net - Virtual/Dedicated non-VDI Hosting.

  5. #5
    SitePoint Member Nicholas Brown's Avatar
    Join Date
    Mar 2001
    Location
    UK
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <figured it out - im a fool >
    Last edited by Nicholas Brown; Jul 20, 2001 at 13:13.
    Nicholas Brown
    Twilight-Online.net - Virtual/Dedicated non-VDI Hosting.

  6. #6
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If what you have posted is the entire script then it is rather esoteric As firepages says what is $d->hits++; ? Where have you instantiated an object $d? Where is the class definition? (usually included by way of an include file). Or is the object created from a mysql_query result set?

    Also, as Firepages alluded to with his code, *if* the purpose of this script is to increment the value of a field in the database then this mathematical operation can be achieved in the SQL query itself. Repeating Firepage's sql:

    UPDATE affiliates SET hits=hits+1 WHERE username='$username'

  7. #7
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Need more info really, but this could be a problem:
    affiliate.php?user
    That link should look like this:

    http://yoursite.com/affiliate.php?username=Skunkeh (for example)

    What is the $d->hite++ bit about? If you have a class / object defined you need to stick the code on here so we can see that as well.

    Add some debugging code like this:
    PHP Code:
    $sql "UPDATE affiliates SET hits=hits+1 WHERE username='$username'";
    mysql_query($sql);
    echo 
    $sql
    That will display the SQL so you can check if it's right - do that and post it on here so we can see if that's the problem,

  8. #8
    SitePoint Member Nicholas Brown's Avatar
    Join Date
    Mar 2001
    Location
    UK
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <figured it out - im a fool >
    Last edited by Nicholas Brown; Jul 20, 2001 at 13:12.
    Nicholas Brown
    Twilight-Online.net - Virtual/Dedicated non-VDI Hosting.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •