SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php,as,mysql ---> help !!

    hi all

    i don`t is this the best forum to post my Q. !

    i trying to make php, mysql, flash menu, but i have some prob, and i don`t know where is the problem !?

    i have swf, inside it there are 1 mc which include textbox, with name "name" ,i put in the main time line, and worte this as :
    Code:
    onClipEvent (load) {
        this.loadVariables("menu.php");
    }
    onClipEvent (data) {
        n = 7; // letter will get this int from mysql row num!
        for (var i = 1; i<=n; i++) {
            _root.name.duplicateMovieClip("newname"+i, i);
            _root["newname"+i]._y += i*20;
        }
    }
    and the the menu.php :

    PHP Code:
    $db = @mysql_connect($server,$username,$password);
    mysql_select_db($database);

    $query=mysql_query("select * from $table");
    echo 
    "&name=";
    while ((list(
    $id$name$link)=mysql_fetch_array($query))){

    echo 
    "$name&";


    the duplicate Movie Clip is wroking fine, but is showing me just the last row from the db. !

    any1 know where is the error ?



    thx for ur time and help

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Two things, you never conactenate the names on to each other and you need to retuen the urlencoded string instead of echoing it.

    PHP Code:
    $db = @mysql_connect($server,$username,$password);
    mysql_select_db($database);

    $query=mysql_query("select * from $table");
    $str .= "&name=";
    while (
    $row mysql_fetch_array($query)){
        
    extract($row);
        
    $str .= "$name&";
        }
    return 
    urlencode($str); 
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx alot for the code, but i think u froget the echo

    Code:
    $query=mysql_query("select * from $table");
    $str .= "&name=";
    while ($row = mysql_fetch_array($query)){
        extract($row);
        $str .= "$name-$id&";
        echo $str;
        }
    return urlencode($str);
    but is the same, it`s listing just the 1st row now

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright, I am confused as if there are more than one name only one name= is present in the string. Could you please show me exactly waht the string should look like that gets passed to flash?


    Is it supposed to be.

    name=john&peter&bob

    or

    name1=john&name2=peter&name3=bob


    Also the return instead of echo will owrk just fine, your flash movie calls for variables formed in this file, if your file merely returns the string then that is perfectly accpetable and probably better than echoing it to the screen.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so ..

    in the flash mc, there are textbox, with name "name", as var. .

    and it`s must look like this "$str .= "$name-$id&";" :

    Mario - 1
    max -2
    dude -3
    site -4

    but it`s repete it for 7 time, as i gived in falsh actionscript the n=7, and the result must be to view all the rows from the db. as u see in the code.

    in the flash actionscript i`ll dublicate the textbox, the var. "name" , so i`ll get 7 textbox with this names :
    name
    name1
    name2
    .
    .
    name6

    and i think this the problem, coz in the php i worte name=blalal , and i leave the other name# , but i don`t know how to do this


Bookmarks

Posting Permissions

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