I have an MYSQL table with a large product list. In this product list table there are categories, a name, description, text, etc. I want to add a modifier for the industries that it can be used in (e.g. hospitals, schools, events, sport events, etc.)
I'm running this query through PHP/MYSQL right now:
public function GetIndustrySeries($identifier, $SeriesIDArray = null)
{
$query = "select ser.Identifier,
ser.ModelNumber,
ser.Title,
ser.Caption,
ser.Description,
ser.Picture,
ser.Industry,
cat.TitleText,
ser.AutoID,
ser.BasePrice
from ProductSeries ser
inner join
ProductIndustry cat
on
cat.Industry
=
ser.Industry
where
ser.Industry
like
?";
if($SeriesIDArray != null && count($SeriesIDArray) > 0)
$query .= " and ";
$i = count($SeriesIDArray);
$parameters = array();
$parameters[0] = "s";
$parameters[1] = $identifier;
if($SeriesIDArray != null){
foreach($SeriesIDArray as $id)
{
$parameters[0] .= "i";
array_push($parameters, $id);
$query .= " ser.AutoID = ?";
if($i > 1)
$query .= " or ";
$i--;
}
}
$stmt = $this->_mysqli->prepare($query);
//$stmt->bind_param('ss', $identifier);
call_user_func_array(array($stmt,'bind_param'), $parameters);
$stmt->execute();
$stmt->bind_result($ident2, $model, $title, $caption, $description, $picture, $ident, $catText, $sid, $price);
$stmt->store_result();
if($stmt->num_rows < 1)
{
$stmt->close();
return null;
}
$array = array();
while($stmt->fetch())
{
array_push($array, array('seriesLink' => "/products/$ident2/$model", 'seriesTitle' => $title, 'seriesImage' => $picture, 'seriesCaption' => $caption, 'seriesDescription' => $description, "seriesCategoryName" => $catText, "seriesID" => $sid, "basePrice" => $price));
}
$stmt->close();
return $array;
}
I've tried using the % modifier in that code on both sides of the ? but I'm getting an error down the line:
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Array' was given in C:\wamp\www\database.php on line 70.
In the table I have a column for "Industry" and what I want to do is put the industries that the product qualifies for in there hoping it can accept multiple values: "school,hotel,hospital"