A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: flash, php and mysql integration

  1. #1
    Member
    Join Date
    Sep 2007
    Posts
    80

    flash, php and mysql integration

    I have a database in MySQL that stores binary data for images that are uploaded by a user. I want to display 20 of those pictures at once. My question is, should i just use a loop in flash, and call my php script and select one row at a time and return the data that way? or can php return all 20 at the same time and how would i parse it in flash? I can give more info if needed.

    Kyle

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I would cycle through the rows in the php file using a while loop and load one by one in flash.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Sep 2007
    Posts
    80
    Is it possible to get a little more detail on that? So are you saying one call in flash to the php script? How do I then make the php script send it like that one at a time? I'm not sure the 'relationship' between flash and php. wouldnt the script loop through and do whatever before ever sending any data back to flash?

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Here is a script from a file where actually strings are compared. It will cycle through all rows until the number of rows matches the final row. There is only one call for the php file.
    PHP Code:
    $query "SELECT * FROM $myTable";
    $result = @mysql_query($query);
    $matchCounter 0;
    $rowCount=0;
    $finalRow=mysql_num_rows($result);
    $xmlNodes "";
    $num_rows 0;
    //if there are rows...
    if ($result && @mysql_num_rows($result) > 0)
    {
        
    //
           //we loop through the rows...
           //
        
    while($row mysql_fetch_array($result))
        {
            
    $data $row['data'];
            
    $rowCount++;
                
    //
                // comparing strings
                //
            
    $newResult substr_count(strtolower($data),strtolower($searchItem));
            if(
    $newResult >= 1)
            {
                 
    $matchCounter++;
                 
    $xmlNodes .= "$data";
            }
            if(
    $rowCount>=$finalRow)
            {
                
    $num_rows 1;
            }
            
    "myResult=" urlencode($xmlNodes);
        }
        echo 
    "matchCounter=$matchCounter&num_rows=$num_rows&myResult=" urlencode($xmlNodes);

    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Member
    Join Date
    Sep 2007
    Posts
    80
    Hope I'm not sounding dumb, but I'm learning this as I go haha,

    I actually have done a script like that already, but for simply text data, but the data I want to send back is binary data that contains an image, so can those be strung together and then parsed individually in flash as 20 seperate pictures?

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I understand. I am not expert enough for that, since I usually store urls for images but not the images themselves.
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    Member
    Join Date
    Sep 2007
    Posts
    80
    I was just now thinking that I should probably do that, the only reason I hadn't at first is just so the server wasn't cluttered with files and this way it was just all stored in the database. But I'm starting to think it'd be easier just to build a string of urls seperated by a delimiter and send back to flash.

    thanks for the help!

  8. #8
    Junior Member
    Join Date
    Jan 2009
    Posts
    1

    PHP,MYSQL,LINUX,Flash

    Hello,

    I want some help for the below given.

    This is for a Php based shopping cart on Php,MySql database and Linux.The images have to be pulled automatically for the no of records from the MySql table and should be used to display a image on the flash slider with a link which when clicked should open a page on the seperate window.

    The flash slider should accomodate all the images/records in the table and when new images or records are added it should automatically insert them in the slider.

    Hell Magic

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center