I get a string something like this, "voornaam, achternaam"
I give that to a function.
When I used the string to get the data from the database.
mysql_query("SELECT."$string". FROM ...")
this all goes good.
Now. I want to give back the values that I selected from the DB.
I tried something like this.
<?php
function user_info($user_id, $fetch = "")
{
if (ctype_digit($user_id))
{
if (empty($fetch))
{
$fetch = "*";
}
$query = mysql_query("SELECT ".$fetch." FROM accounts WHERE ID = '".$user_id."'");
$data = mysql_fetch_assoc($query);
$data['password'] = NULL;
}
if (empty($fetch))
{
return $data;
}
else
{
$fetch = explode(", ", $fetch);
print_r($fetch);
while($param = $fetch) {
return $data[$param];
}
}
//$item_result['created_by'] gives back a digit
user_info($item_result['created_by'], 'voornaam, achternaam')
Im stuck in the while loop.
I am not realy that good in the loops.
So i tried something and to me its seems logical.
But in some way it wont work.
$param?