PHP & MySQL only 8 row at a time?

Discussion in 'PHP' started by Ex0duS, May 19, 2006.

  1. #1
    Hello people

    I've got a question

    I wrote a script in php what scans folder and subfolders for MP3 files.
    then add's them to a MySQL database.
    The problem is that it only add's 8 files en then stops....

    i put the php file and the mySQL file on a server, so you can download it
    and take a look at it.
    you can find the files on http://members.lycos.nl/Exodus-design.zip

    the comments are in dutch sorry for that.


    Please help me people

    Yours Truly
    René
    Ex0duS Design
     
    Ex0duS, May 19, 2006 IP
  2. BrianR2

    BrianR2 Guest

    Messages:
    734
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i got a 404 error for that url
     
    BrianR2, May 19, 2006 IP
  3. dct

    dct Finder of cool gadgets

    Messages:
    3,132
    Likes Received:
    328
    Best Answers:
    0
    Trophy Points:
    230
    #3
    Can you just post the code that you think causes the problem here to save us having to download it.
     
    dct, May 19, 2006 IP
  4. Ex0duS

    Ex0duS Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    the code isn't realy that big but oke

    here it is
    
    function Music2DB($arr_mp3, $map){
    	$count_mp3 = 0;
    	while($count_mp3 < count($arr_mp3)){
    		$mp3file = $arr_mp3[$count_mp3];
    		$sql="INSERT INTO mp3files (mp3_pad, mp3_file) VALUES ('../../$map/', '$mp3file')";
    		mysql_query($sql) or die($foutmelding);
    		$arr_toegevoegt[] = ("\"$mp3file\" als:<br> \"$map/$mp3file\"");
    		$count_mp3++;
    	}
    	return $arr_toegevoegt;
    }
    Code (markup):
    send in a array containing all mp3files
    and $map as in the dir containing the mp3's

    return $arr_toegevoegt for display

    need more?
     
    Ex0duS, May 19, 2006 IP
  5. TheHoff

    TheHoff Peon

    Messages:
    1,530
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    0
    #5
    What is this?

    mysql_query($sql) or die($foutmelding);

    foutmelding?

    If that query fails it doesn't look like you will see the error. It is probably something like a bad quote in the filename.

    Also put

    echo sizeof($arr_mp3);

    at the top of the function so you can see how many rows are passed in
     
    TheHoff, May 19, 2006 IP
  6. dct

    dct Finder of cool gadgets

    Messages:
    3,132
    Likes Received:
    328
    Best Answers:
    0
    Trophy Points:
    230
    #6
    Do as hoff says and also in the loop add
    
    echo $sql ."<br />";
    
    PHP:
     
    dct, May 19, 2006 IP
  7. Ex0duS

    Ex0duS Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    the first meens that if the mysql-query ($sql) <- the insert tag
    doen't work it stops the script and displays a predefined error-report.
    that works perfectly that's not the problem.
    the problem is that it only add's the first 8 row's of the inserted mp3_array.

    here is the link again of my files... maybe this clears it up a bit

    http://members.lycos.nl/renethuh/Exodus-design.zip
    sorry i wrong linked it (A)

    thanks anyway

    edit--

    just tried it
    displays the sql-input query until row 8 then stops
    if I comment the insert to DB en retry the script..it works
    for all maps... don't get it anymore

    edit-- again

    don't know what i just did
    but it works now :D
    thank you all
    and cu next time!!

    Ex0duS Design
     
    Ex0duS, May 19, 2006 IP
  8. TheHoff

    TheHoff Peon

    Messages:
    1,530
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Yes, it is because there is something malformed in your query.

    Do as DCT said -- remove the actual insert and just echo the SQL. I doubt you're going to get anyone to download your app, set it up, and troubleshoot it offline.
     
    TheHoff, May 19, 2006 IP