Hello,
I have a problem with my flat file database...
they are built like this:
With the code I want the strings before the : shall be variable names and the string after shall be the value. THen I can use it like this:Code:title:BLALBL brief:Cool thing thing:asdf image[0]:http://.... image[1]:http://....
Do you understand?? Here is my code that is nearly working::PHP Code:
<?php
echo $title;
echo "<p>$brief</p>";
echo"<img src='$image[0]' />";
echo"<img src='$image[1]' />";
?>
The only problem is that the $image array (or any other array) will not work!! I can figure out what I do wrong. Thanks for any helpPHP Code:<?php
$file = file("../../txt/datafile.txt");
foreach ($file as $line_num => $line){
${"t".$line_num}=explode(":",$file[$line_num]);
// creating arrays ($t0,$t1,$t2 ...)
$${"t".$line_num}[0] = ${"t".$line_num}[1];
?>![]()


LinkBack URL
About LinkBacks
Reply With Quote
