Im not sure how best to phrase this, and I am a newbie, but basically I was wondering if its possible to create a function that has a dynamic variable in the code that is executed. For instance:
function getData($array)
{
$result = mysqli_query($con, $query) or die(mysqli_error($con));
$array = array();
while ($row = mysqli_fetch_assoc($result)){
$array[] = $row;
}
}
$query = "SELECT name FROM color ORDER BY name";
getData ($color_array);
$arrayCount = count($color_array);
So $array is the value i would like to be able to change each time i run the function against a new query. For instance after the above I could do:
$query = "SELECT name FROM size ORDER BY name";
getData ($size_array);
$arrayCount = count($size_array);
I guess a placeholder may be a better description of what I'm looking to use.
Cheers