Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2006
    Thanked 1 Time in 1 Post

    addslashes() issue

    I am trying to put add slashes to a script and it is not doing and it returns nothing so could someone please look and tell me what the issue is?

    PHP Code:
     $location= addslashes($row['song_file']);
         $image= addslashes($row['image_file']);

        //XML Header
        $XML = '<?xml version="1.0" encoding="UTF-8"?>';
        $XML .= "
    <playlist version='1' xmlns='http://xspf.org/ns/0/'>

        //loop through all Tracks in database
         while($row = mysql_fetch_assoc($result)){

                $XML .= "<track>\n";
                $XML .= "<title>" . $row['song_name'] . "</title>\n";
                $XML .= "<location>http://store.labelfreeartists.com/" . $location.  "</location>\n";
                $XML .= "<image>http://store.labelfreeartists.com/" . $image.  "</image>\n";
                $XML .= "<info>" . "http://store.labelfreeartists.com/product_info.php?products_id=".$row['cart']. "</info>\n";                        
                $XML .= "<lyrics>" . "view_lyrics.php?song_id=" . $row['id'] . "</lyrics>\n";
                $XML .= "<add>" . "add_song.php?id=" . $row['id'] . "&member_id=".$row['original_id']. "</add>\n";            
                $XML .= "<rate>" . "rate_songs.php?id=" . $row['id'] . "</rate>\n";            
                $XML .= "</track>\n";

        //XML Footer
         $XML .= "</trackList>
    I am trying to add slashes to the $location and $image and after the XML file is written it there is nothing where the variables should be. anyone got a clue?

  • #2
    Regular Coder
    Join Date
    Aug 2006
    Thanked 1 Time in 1 Post
    yeah...I'm an idiot and forgot to put the variable inside the while loop

  • #3
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Denver, Colorado USA
    Thanked 339 Times in 331 Posts
    Ummm. We noticed that. That is probably why no one bothered to answer. The error in the logic is obvious to anyone who actually looked at the code.

    People, not just Jacobb123, when you have code that does not function as you intend, as the first step in troubleshooting it, it is your job as the programmer who wrote the code or are re-using code you got from some place to read through it to make sure the logic is doing what you want it to do. Programs can only do what the program logic says to do and the program logic is what you as the programmer wrote or are re-using.

    Just posting code in a Forum, stating it does not work or has an error, and asking some other programmer to tell you what is wrong with it, should not be your first troubleshooting step. It takes a really long time to produce code that accomplishes anything when you wait around for someone in a Forum to troubleshoot your code, when reading it, reading the error message, reading a programming language reference, or searching the Internet will usually solve the problem in a small fraction of the time.

    Frankly, programming forum members would rather read and try to solve real programming problems, rather than proof read bogus program logic or language syntax errors.
    Last edited by CFMaBiSmAd; 10-29-2007 at 01:38 PM. Reason: add more
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.


    Posting Permissions

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