PHP not give back duplicate columns
Hello,
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:
<?php
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;
print("&getallennaam=");
while($ourData = @mysql_fetch_array($query)){
$name = $ourData["flashgetallen"];
$counter++;
print("$name,"); //gives me back just one, two, three instead of one,two,one,two,three
}
print("&geladen=1");
?>