I want to use a PHP include file for a soft DB of about 20 elements. The actual data will be collected from RRD files and thus I prefer not to use MySQL just for 20 elements. The file fruits.php for the elements I'm trying something like:
<?php
$fruit="Apple"; $colour="red";
$fruit="Banana"; $colour="yellow";
$fruit="Pear"; $colour="green";
?>
In my recall file, results.php, I currenlty have the following code to recall the information from the fruits.php file:
<?php
include 'fruits.php';
$num=count($fruit);
$i = 0;
while ($i < $num){
echo "<p>My ".$fruit." is ".$colour.".</p>";
$i++;
}
?>
Since I'm not a proper scriptor/programmer, I'm quite blind to what should be different and stupid to proper coding. I have tried some other methods as well, one included:
$num=glob($fruit);
Any assistance with this will be really appreciated. Just to confirm the output I'd like for this code is to be:
My Apple is red.
My Banana is yellow.
My Pear is green.