73 users online (0 members and 73 guests)  

Thread: Problem in tags


  Results 1 to 9 of 9

Related

  1. Replies: 5
  2. meta tags    Forum: Search Engine Optimization - SEO - Forum
    Replies: 9
  3. Tags????????????    Forum: HTML Forum
    Replies: 4
  4. Table tags    Forum: HTML Forum
    Replies: 1
  1. #1
    bertugolu's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2007
    Posts
    15

    Question Problem in tags

    I am writing a script that holds my id3 tags in a database...now i have about 3 gb of music and when the amount of music exceeds 80mb (the max size supported by the server), a fatal error is given off.

    PHP Code:
    <html>

    <body>

        <?php
            
    include 'cnt.php';


                
    $POST_list=@mysql_query('SELECT ID,Filename, Name, Artist FROM test');
                    if (!
    $POST_list)
                        {
                        exit(
    '<p>Error performing query: ' mysql_error() . '</p>');
                        }
                        
                    
                    
                

            
                    
                    if(isset(
    $_POST['write'])) 
                        {
                        while (
    $row0 mysql_fetch_array($POST_list1))
                            {
                                
    $song0="name";
                                
    $artist0="artist";
                                
    $id0=$row0['ID'];
                                
    $id1="$id0$song0";
                                
    $id2="$id0$artist0";
                                
    $name2=$_POST["$id1"];
                                
    $artist2=$_POST["$id2"];
                                
    $insertnewmysql_query("UPDATE test SET Name='$name2', Artist='$artist2'  WHERE ID='$id0'");
                    
                            }
                            
                        }    

                                echo 
    "<table border=0>
                                <tr> 
                                    <td>
                                        <b> Filename </b> 
                                    </td>
                                    <td>
                                        <b> Name </b> 
                                    </td>
                                    <td>
                                        <b> Artist </b> 
                                    </td>
                                </tr>"
    ;
                                
                    echo 
    "<form action='nameditor.php' method='POST'>";
                        while (
    $row mysql_fetch_array($POST_list))
                            {
                            
                            
    $id=$row['ID'];
                            
    $song5=$row['Name'];
                            
    $artist5=$row['Artist'];
                            
    $filename=$row['Filename'];
                            
    $target="C:\\wamp\\www\\player\\music\\";
                            
    $target1="$target$filename";
                            
    $tag=id3_get_tag("$target1");
                            
    $title=$tag['title'];
                            
    $artist=$tag['artist'];
                            
    $song0=name;
                            
    $artist0=artist;
                            
                            
                            
    $song5=$tag['title'];
                            
    $name1="$id$song0";
                            
    $artist1="$id$artist0";
                            
                            if (empty(
    $song5))
                                {
                                    
    $song5=Unknown;
                                }
                            
                            if (empty(
    $artist5))
                                {
                                    
    $artist5=Unknown;
                                }
                                
                                echo 
    "
                                    <tr>
                                    <td>"
    ;
                                        echo 
    $row['Filename'];
                                    echo 
    "</td>
                                    <td>"
    ;
                                        echo 
    "<input type=text name='";
                                        echo 
    "$name1' value='$title'>
                                    </td>
                                        <td>"
    ;
                                        echo 
    "<input type=text name='";
                                        echo 
    "$artist1' value='$artist'>
                                    </td>"
    ;    
                            }
                
                        echo 
    "</table>";
                        echo 
    "<input type=hidden name=write value=1>";
                        echo 
    "<input type=submit value='Write values'>";
            
        
                
     
        
    ?>
     
     </body>
     
     </html>
    and this is the error


    Fatal error: Allowed memory size of 104857600 bytes exhausted (tried to allocate 1852404086 bytes) in C:\wamp\www\player\nameditor.php on line 61

    help please!

  2. #2
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel

    Re: Problem in tags

    Looks to me like you need to increase the memory limit in php.ini

    Dave
    AHFBWEB Less customers per server, more power for you!

    Business Class Shared Hosting

  3. #3
    bertugolu's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2007
    Posts
    15

    Re: Problem in tags

    But why just getting the id3 tags would consume a lot of memory??

    Tried already increasing it to 1.6gb but when have it that value...i had problems with memory

  4. #4
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel

    Re: Problem in tags

    I am a big dummy with this stuff, maybe somebody can look at the code and attempt to make it more efficient.

    D
    AHFBWEB Less customers per server, more power for you!

    Business Class Shared Hosting

  5. #5
    bertugolu's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2007
    Posts
    15

    Re: Problem in tags

    I shortened the program to make it more legible.

    Still, i am getting the same error

    PHP Code:
    <?php

        
    include 'cnt.php';

        
    $get=mysql_query('SELECT ID,Filename, Name, Artist FROM test');
        
    $target="C:\\wamp\\www\\player\\music\\";
        
            while(
    $get1=mysql_fetch_array($get))
            {
                
    $name_song=$get1['Name'];
                
    $filename=$get1['Filename'];
                
    $target1="$target$filename";
                
    $tag=id3_get_tag("$target1");
                echo 
    $tag['title'];
                echo 
    "<br />";
                
                
                
            }
    ?>

  6. #6
    DeadMeatGF's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    381

    Re: Problem in tags

    Have you tried debuging?
    For example:
    PHP Code:
    <?php

        
    include 'cnt.php';

        
    $get=mysql_query('SELECT ID,Filename, Name, Artist FROM test');
        
    $target="C:\\wamp\\www\\player\\music\\";
        
    /*      while($get1=mysql_fetch_array($get))
            {
                $name_song=$get1['Name'];
                $filename=$get1['Filename'];
                $target1="$target$filename";
                $tag=id3_get_tag("$target1");
                echo $tag['title'];
                echo "<br />";
    */            
    echo "Returned ".mysql_num_rows($get)." songs<br />";            
                
            }
    ?>
    If you're getting thousands of songs, that could account for the memory requirements. If you've got thousands of songs, then you may need to return the data in chunks, if not you'd need to find out why it's returning too many results.
    Also check out your PHP version and search www.php.net for any issues with memory for that version.
    Last edited by DeadMeatGF; 04-23-2007 at 03:52 AM. Reason: changed from code to php tags ;)

  7. #7
    firmaterra's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    81

    Re: Problem in tags

    Try using limits in your sql query...eg 1000 songs at a time. Also how long does it take your script to respond?? You may need to increase script time as well in PHP.ini
    Last edited by firmaterra; 04-27-2007 at 06:39 AM. Reason: misspelling

  8. #8
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel

    Re: Problem in tags

    Welcome to the forums firmaterra

    Dave
    AHFBWEB Less customers per server, more power for you!

    Business Class Shared Hosting

  9. #9
    flann's Avatar
    New User

    Status
    Offline
    Join Date
    May 2007
    Posts
    18

    Re: Problem in tags

    I would reccomend limiting the amount of songs so that your dataset that is getting returned is much smaller. This will ease the load off of the database and everything else.

    example..

    SELECT whatever
    FROM whereever
    LIMIT 20

    you can also create a paging system where you limit the amount of data coming out of the database then offset based on what page they're on.

    page 1 showing 10 results
    SELECT whatever
    FROM wherever
    LIMIT 0, 10

    page 2 showing 10 results
    SELECT whatever
    FROM whereever
    LIMIT 10, 10



Tags for this Thread