PHP help (reading a text file)?

Goddard

New member
I need help with this. I've got a text database with peoples' profiles in it. The format is like this,

:1
Hello I am the first profile, how are you :)
:2
Hi I'm new here so nice to meet you
:3
I'm from Australia... or am I?

, please help, because it shows up as nothing when I try to ask for the very last profile (index.php?p=3).

if (isset($_GET["p"])) {
$file = fopen("prof.txt", "r");
while (!feof($file)) {
$string = rtrim(fgets($file));
if (strpos($string, ":") === 0) {
if (substr($string, 1) == $_GET["p"]) {
$string = fgets($file);
while (!(strpos($string, ":") === 0)) {
echo $string;
$string = fgets($file);
}
... The rest is private server info but this is all that's important
 
Back
Top