Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- $product[] = [
- "ID" => $row["ID"],
- "Name" => $row["Productname"],
- "Price" => $row["Pricetag"],
- "Supply" => $row["Productsupply"],
- "Type" => $row["Producttype"],
- "Tags" => $row["Tags"],
- "Materials" => $row["Materials"],
- "Date" => $row["Releasedate"],
- "Description" => $row["Description"],
- "isDigital" => $row["isDigital"],
- "MainPhoto" => $row["MainPhoto"],
- "Photo01" => $row["Productpic01"],
- "Photo02" => $row["Productpic02"],
- "Photo03" => $row["Productpic03"]
- ];
- }
- } else {
- echo "0 results found. Please check database connection.";
- }
- $Filterarray = array('Pluimstaart'); //Might filter on more keywords in future usage.
- $newArr = array();
- foreach ($product as $key => $value) {
- foreach ($value as $finalVal) {
- if(in_array($finalVal, $Filterarray)){ // check if available in filter array
- $newArr[$key]["ID"] = $value["ID"];
- $newArr[$key]["Name"] = $value["Name"];
- $newArr[$key]["Price"] = $value["Price"];
- $newArr[$key]["Supply"] = $value["Supply"];
- $newArr[$key]["Type"] = $value["Type"];
- //$newArr[$key][] = $finalVal;
- }
- }
- }
- Array
- (
- [1] => Array
- (
- [ID] => 1
- [Name] => Pluisje de Pluimstaart
- [Price] => 75
- [Supply] => 0
- [Type] => Pluimstaart
- )
- [5] => Array
- (
- [ID] => 69
- [Name] => Blizzard de Pluimstaart
- [Price] => 75
- [Supply] => 1
- [Type] => Pluimstaart
- )
- )
- Array
- (
- [0] => Array
- (
- [ID] => 1
- [Name] => Pluisje de Pluimstaart
- [Price] => 75
- [Supply] => 0
- [Type] => Pluimstaart
- )
- [1] => Array
- (
- [ID] => 69
- [Name] => Blizzard de Pluimstaart
- [Price] => 75
- [Supply] => 1
- [Type] => Pluimstaart
- )
- )
Add Comment
Please, Sign In to add comment