#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Quispamsis, NB, Canada
    Posts
    49
    Rep Power
    15
    Hello, I have 2 small problems, the most serious of which is a problem with a MySQL query, It doesn't seem to work when executed through the web on my download.php file.... i'll post the code below. If you can help please do. But before i post the code my other problem is getting the variable $keyword to put "+" signs in between multiple words. If you can help with anything here please post:
    mysql_connect("localhost", "user", "pass");
    @mysql_select_db("mp3findit");
    mysql_query("UPDATE mp3 SET dls=dls+1 WHERE id='$id'");
    mysql_query("update mp3 set checked='$ctime' where id='$id'");
    $query = "select * from mp3 where id=$id";$mysql_result = mysql_query($query);
    while($row = mysql_fetch_row($mysql_result))
    {
    $artist = $row[1];
    $song = $row[2];
    $url = $row[3];
    $size = $row[4];
    $dls = $row[5];
    $added = $row[6];
    $checked = $row[7];
    $provsite = $row[8];
    $provurl = $row[9];
    $provemail = $row[10];
    }
    $stitle = "Download $artist - $song";
    include("path/header.php3");
    $position = trim($url);
    $file = parse_url("$url");
    $isthere = @fopen("$url", r);
    if($isthere)
    {
    print("
    <SCRIPT LANGUAGE="JavaScript" SRC="http://www.mp3findit.com/xdrive.js"></SCRIPT>
    <h3><font face="Arial">Download Your Mp3</font></h3>
    <font face="Arial" size="2">
    Provided By: <a href="link.php3?site=$provsite&url=$provurl" target="_blank">$provsite</a><br>
    ID: $id<BR>
    Path: $file[path]</a><BR>
    Name: $artist - $song<BR>
    Downloads: $dls<BR>
    Added To Database: $added<br>
    Last Verifyed: $checked<br>
    <a href="$url">Click here To Download Your Mp3</a><br>
    <a href="javascript:xd_skip('$url')">Download $song Directly To Your <b>X-Drive</b> Account!</a><br>
    <a href="http://tracker.clicktrade.com/tracker/tracker.dll?to='http://www.myplay.com/dd/mp/?rurl=$url&sv=023-04-08'&lp=317580&ad=331278">Download $song Directly To Your <b>MyPlay</b> Locker!</a>
    <br><br>
    <font size="3" face-"Arial"><b>Quick Help</b></font><br>
    <font size="2" face-"Arial">
    Can't seem to get the file to download? Try <b>RIGHT</b> clicking on the link, then you should see
    a dropdown menu in your browser. Choose "Save Target As" (IE), or "Save Link As" (Netscape).
    If this does not work, check out our <a href="faq.php3">Frequently Asked Questions</a> section.");
    }
    else
    {
    mysql_pconnect("localhost", "user", "pass");
    @mysql_select_db("mp3findit");
    mysql_query("DELETE FROM mp3 WHERE id='$id'");
    print ("<font face="arial" size="2">This link no longer exists and is being deleted from the database. We are sorry for any inconvenience.");
    }
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Malaysia
    Posts
    13
    Rep Power
    0
    about ur 2nd problem, try

    $myvar = "chiasa aonuma";

    // replace every occurence of " " with "+"
    $myvar = strtr($myvar, " ", "+");

    refer to the php manual for more details about the function strtr()

  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Quispamsis, NB, Canada
    Posts
    49
    Rep Power
    15
    That works, but then it makes it search for the keywords with "+" signs in them.....

    -Scott
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    63
    Rep Power
    15
    Try using urlencode() instead of strtr().

    http://www.php.net/manual/function.urlencode.php

  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    London/UK
    Posts
    91
    Rep Power
    15
    Hi the regexp is fine, but take a look @ urlencode($string) and urldecode($string) it'll be faster, works for more than a space and it saves typing =)

    Bealers

    ------------------
    http://back-end.org
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Ontario, Canada
    Posts
    498
    Rep Power
    18

    mysql_query("UPDATE mp3 SET dls=dls+1 WHERE id='$id'");
    mysql_query("update mp3 set checked='$ctime' where id='$id'");


    Where's this $ctime coming from? Are you trying to set the checked time to the current unix timestamp? And also, wouldn't it be easier to make the DLS field an auto-incrementing number?

    ------------------
    To alcohol! The cause of, and solution to, all of life's problems. -- Homer Simpson

Similar Threads

  1. 2 small perl sci problems....
    By Nik in forum Perl Programming
    Replies: 1
    Last Post: February 8th, 2004, 04:09 PM
  2. Have one small image overlay over a bigger image?
    By Arribadia in forum PHP Development
    Replies: 2
    Last Post: January 28th, 2004, 03:48 AM
  3. Popup problems from Flash in IE6
    By jmichels in forum Flash Help
    Replies: 19
    Last Post: January 6th, 2004, 03:27 PM
  4. problems using fgets
    By Dezzy in forum C Programming
    Replies: 2
    Last Post: November 7th, 2003, 12:18 AM
  5. Session variable problems on self referencing page
    By brandon41 in forum PHP Development
    Replies: 1
    Last Post: October 26th, 2003, 10:50 PM

IMN logo majestic logo threadwatch logo seochat tools logo