Thread: Problem in tags
Results 1 to 9 of 9
Related
-
problem in scrollable table by <div> tags Forum: CSS Forum
Replies: 5 -
meta tags Forum: Search Engine Optimization - SEO - Forum
Replies: 9 -
Tags???????????? Forum: HTML Forum
Replies: 4 -
Table tags Forum: HTML Forum
Replies: 1
-
04-22-2007, 08:28 AM #1
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"];
$insertnew= mysql_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>
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!
-
04-22-2007, 08:47 AM #2
Re: Problem in tags
Looks to me like you need to increase the memory limit in php.ini
Dave
-
04-22-2007, 08:58 AM #3
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
-
04-22-2007, 09:24 AM #4
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
-
04-23-2007, 02:51 AM #5
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 />";
}
?>
-
04-23-2007, 03:52 AM #6
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 />";
}
?>
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 ;)
-
04-27-2007, 06:39 AM #7
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
-
04-27-2007, 07:19 AM #8
Re: Problem in tags
Welcome to the forums firmaterra
Dave
-
05-04-2007, 01:59 PM #9
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