Hi, I was recently given the job of displaying the info in a text file on a php page for an Estate Agents. The text file is comma delimited.
I am quite pleased with how far I have got but I am stuck with something. The text file is here and the HTML page is here. So far so good! The code I use is here.
quote:
<?ph p
$array = file('xfile.txt');
foreach($array as $row) {
$line = explode('","', $row);
print "<table width='600' border='0' align='center' cellpadding='0' cellspacing='0' bgcolor='#000000'>
<tr>
<td><table width='600' border='0' cellspacing='1' cellpadding='0' height='54'>
<tr align='center' valign='middle' bgcolor='#6AA3CC'>
<td height='19' colspan='2' align='left'><table width='100%' border='0' cellspacing='0' cellpadding='5'>
<tr><font size='2'>
<td align='left' valign='top'><div align='left'><font face='Arial, Helvetica, sans-serif' size='2'><b>$line[3]</b></font></div></td>
<td align='right' valign='top'><div align='right'><font face='Arial, Helvetica, sans-serif' size='2'>£$line[7]</font></div></td>
</font></tr></table> </td></tr><tr align='center' valign='middle'><td width='32' height='32' align='left'><img src='http://www.londonorient.com/tCITY_$line[1].jpg'></td><td width='565' align='left' valign='top' bgcolor='#FFFFFF'><table width='100%' border='0' cellspacing='0' cellpadding='5'><tr><td align='left' valign='top'><font face='Arial, Helvetica, sans-serif' size='2'><b>Description:</b> $line[38]</font></td> </tr>
</table></td>
</tr>
</table></td>
</tr>
</table><br>";
}
? >
</html>
Up until now I am only able to print the whole array. Eg, If I type
print "$line[2]";
it will print the second element off each line in the text file, in this case the property reference. What if I only wanted to print the reference of a property on the third line of the text file? Do I have to make a multi-dimensional array and if so how do I go about it with the text file?
Thanks