Greetings - I am a newbie to this forum and to PHP and would appreciate assistance in formatting script to a specific format required by my application. Others may recognize the script from the data content. It is for “Smart Search”.
Here is the required format of the array from the original application
[php]
[/php]
Notice that I require one array $products and that it lists various items (fruit) providing details of name, image, description, url details for each item.
Now I want to create the same array format from my database and herein lies my problem.
I can replicate and make this work for the first row of my table but I don’t know how to loop through all valid items from my query.
Here is my code:
[php]
[/php]
As you can see in the above code - I would appreciate help to be able to loop through line 12 using a do . . .while or for . . . next, whatever, to read all valid items into this one array call products.
If you can provide a working example - or links to where I may glean a valid answer - it would be much appreciated.
Thank you in anticipation
Kind regards
AceTutor