Well, I have been working on learning PHP so that I can have new users on a website, and information for scheduling sent via email. Some of the information needs to stay in a database in order to call it back such as the user's userid the password their phone number email address and real name.
so, I have been working on taking some exhisting codes off the net and modifying them as a way of learning what each thing does. I have been succesful with quite a bit of the basic PHP stuff but always get stuck when working with databasing.
In the following code, I am using a Pipe (|) delimited text database with "explode" to echo the data to the screen.
In it's presant state the information that is returned to the screen is is actually a list of each database entry, but what I want to do is print only one entry based on the username. Can someone help me with this...
<?php
$filename ="person.data"; * *
$myFile = fopen($filename, "r");
if(! $myFile){ * * * * * *
print ("File could not be opened.");
exit;
}
$fcontents = file($filename);
while (list ($line_num, $line) = each ($fcontents)) {
*
"<p><b>Line $line_num:</b> " . str_replace("<p>", "", $line) . "<br>\n";
$values = explode("|", $line);
echo "Name: " . $values[2] . " " . $values[3] . "<br>";
echo "email: <a href=mailto:$values[4]> $values[4] </a><br>";
echo "Phone Number: " . $values[5] . "</b>";
}
* * *
fclose($myFile);
?>
Thank you very much in advance
Mike