A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: PHP not give back duplicate columns

  1. #1

    PHP not give back duplicate columns


    I'm building a game in flash with php and mysql.
    By loadvars I send an array to a php-script.
    The php-script should give me back the name in a column as the array is.
    example : 1,2,1,2,3 should give me back one,two,one,two,three

    But it gives me back: one, two, three (and not the extra one and two).

    This is my script:

    PHP Code:
    include 'DB.php';

    $taal $_POST['taal'];
    $getallen $_POST['getallen']; //example: 1,2,1,2,3';

    $conn = @mysql_connect($server,$user,$pass);
    $database = @mysql_select_db($database,$conn);

    $array = array($getallen);
    $ids implode(","$array);

    echo (
    $getallen); //gives me back 1,2,1,2,3 (thats ok)

    $query = @mysql_query("SELECT getallen FROM test WHERE woordgetallen IN(".$ids.") AND `lang_id` = '1' ORDER BY NULL");

    $counter 0;


    $ourData = @mysql_fetch_array($query)){
    $name $ourData["flashgetallen"];
    "$name,"); //gives me back just one, two, three instead of one,two,one,two,three
    Last edited by asjbak; 08-23-2010 at 11:57 AM.

  2. #2

  3. #3
    Senior Member
    Join Date
    Apr 2004
    This code doesn't do much:
    PHP Code:
    $array = array($getallen); 
    That's basically the same as this:
    PHP Code:
    $array = array();
    $array[0] = $getallen
    Then when you try imploding $array, you are just turning it back into a string because array has only one element.

    Also, when you do SQL like this:
    SELECT getallen FROM test WHERE woordgetallen IN(1,2,1,2,3) AND `lang_id` = '1' ORDER BY NULL
    Then you are asking for all records where woordgetallen is either a 1, 2, or 3. If woordgetallen has unique values for each record, you can get at most 3 records.
    Write multiplayer games with FlashMOG 0.3.1
    Try the MyPlan Salary Calculator

Tags for this Thread

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