< ?phpbr>
// Which file is it reading from and writing to?
$filename = "blue.csv";
$fp = fopen($filename,"r");
// Check for problems with the database file.
if (!is_readable($filename)) {
print "Error: couldn't find the database!";
exit;
}
if (!is_writeable($filename)) {
print "Error: the database isn't writeable!";
exit;
}
$array = file($filename);
foreach($array as $row) {
$line = explode("|", $row);
}
// The form, as many as you want to put in the array (eg. $line[55] or $line[99]).
print "";
fclose($fp);
?>
>
< ?phpbr>
// Define our file name.
$filename = "blue.csv";
// Check for problems with the database file.
if (!is_readable($filename)) {
print "Error: couldn't find the database!";
exit;
}
if (!is_writeable($filename)) {
print "Error: the database isn't writeable!";
exit;
}
// Open the file for writing.
$fp = fopen($filename,"w");
if (!$fp) {
print "Error: can't write to the database!";
exit;
}
// What is being written?
$stringtowrite=$a1."|".$a2."\n";
// If the form has been submitted, do things, otherwise display the form.
if ($Submit) {
fwrite($fp, $stringtowrite);
print "Success. Your update is in the database.Click here to go back to the form.";
//readfile($filename);
} else {
print "Nothing to do.";
}
fclose($fp);?>
>
< ?phpbr>
// Define our file name.
$filename = "blue.csv";
$fp = fopen($filename,"a+");
// Check for problems with the database file.
if (!is_readable($filename)) {
print "Error: couldn't find the database!";
exit;
}
if (!is_writeable($filename)) {
print "Error: the database isn't writeable!";
exit;
}
$array = file($filename);
foreach($array as $row) {
$line = explode("|", $row);
print "Team 1: ".$line[0]."
Team 2: ".$line[1]." etc.";
}
?>
>
$game1winner = ';
$game2winner = ';
$game3winner = ';
// etc.
<?php echo $game1winner; ?>
<?php
// Which file is it reading from and writing to?
$filename = "blue.csv";
$fp = fopen($filename,"r");
// Check for problems with the database file.
if (!is_readable($filename)) {
print "Error: couldn't find the database!";
exit;
}
if (!is_writeable($filename)) {
print "Error: the database isn't writeable!";
exit;
}
$array = file($filename);
foreach($array as $row) {
$line = explode("|", $row);
}
// The form, as many as you want to put in the array (eg. $line[55] or $line[99]).
print "<form action=addblue.php method=post name=add>
<input name='a1' 'text' id='a1' value='" .$line[0]." '>
<input name='a2' 'text' id='a2' value='" .$line[1]." '>
<input submit name=Submit value=Submit>
</input></input></input></form>";
fclose($fp);
?>
<?php
// Define our file name.
$filename = "blue.csv";
// Check for problems with the database file.
if (!is_readable($filename)) {
print "Error: couldn't find the database!";
exit;
}
if (!is_writeable($filename)) {
print "Error: the database isn't writeable!";
exit;
}
// Open the file for writing.
$fp = fopen($filename,"w");
if (!$fp) {
print "Error: can't write to the database!";
exit;
}
// What is being written?
$stringtowrite=$a1."|".$a2."\n";
// If the form has been submitted, do things, otherwise display the form.
if ($Submit) {
fwrite($fp, $stringtowrite);
print "Success. Your update is in the database.<a href=blue.php>Click here to go back to the form.</a>";
//readfile($filename);
} else {
print "Nothing to do.";
}
fclose($fp);?>
<?php
// Define our file name.
$filename = "blue.csv";
$fp = fopen($filename,"a+");
// Check for problems with the database file.
if (!is_readable($filename)) {
print "Error: couldn't find the database!";
exit;
}
if (!is_writeable($filename)) {
print "Error: the database isn't writeable!";
exit;
}
$array = file($filename);
foreach($array as $row) {
$line = explode("|", $row);
print "Team 1: ".$line[0]." Team 2: ".$line[1]." etc.";
}
?>
Simplest would be to create a file for each score result, a la Selkirk-Dryden.score and put the number in it, say 23-43.
Then change your page from .html to .php and in every place where there should be a score, put in
< ?php @readfile(selkirk-dryden.score); ?>
where that filename is the appropriate one. (the filename needs to be in quotes but this text box is not escaping them)
You can then just edit the individual files to put the scores in as they happen. The @ supresses the no-file error so you don't HAVE to create the individual files ahead of time. If you create the file ahead of time you can put the nbsp into them, otherwise you should put it in front of the php call.>
posted by phearlez at 9:09 AM on October 27, 2005