SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Feb 2001
    Location
    Screw City
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello...
    I've got a very simple song download popularity checker set up, utilizing the META refresh tag. The META tag works fine, of course. But the MySQL is apparently not working fine. I've been trying to use this through PHP:

    mysql_connect("host:port","username","password") or die ("Database Connection Error.");
    $query = "UPDATE audio_stats SET hits=hits+1 WHERE songID=$song";
    mysql_db_query("database",$query);

    Now, this is the first thing I've actually tried to do with MySQL (aside from a couple tutorial things). the $song variable is passed through the URL, and is also echoed in the META tag, so I know it's fine. And I tried "UPDATE audio_stats SET hits=hits+1 WHERE songID=$song" through phpMyAdmin & it updated the database table as expected (using a relevant songID..not the variable of course). But I cannot get it to update through the actual webpage. Any ideas?

    sod

  2. #2
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try....

    WHERE songID='$song'";

    which is probably the problem, if not try ...

    mysql_db_query("database",$query)or die(mysql_error();

    which will let mysql tell you whats wrong.

  3. #3
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't need quotes around $song because it's an integer.

    What are you using meta refresh for anyway?

  4. #4
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are sending a cookie in the header it is wise not to send a header Location tag at the same time - this can mess up in some browsers and result in the cookie not being written. For that reason I personally always use a META refresh tag to redirect if I'm sending a cookie at the same time.

  5. #5
    SitePoint Member
    Join Date
    Feb 2001
    Location
    Screw City
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The META tag is being used to start the download of the specified song automatically. And the 'quotes' around the $song variable was the solution. I had no idea that was necessary. thanks a lot.

    sod


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
  •