14-03-2006, 00:54
|
|
|
|
חבר מתאריך: 02.09.05
הודעות: 506
|
|
GuestBook לקובץ טקסט
טוב ניסיתי לבנות סקריפט של ספר עורכים, סך הכל שתי משתנים, אחר השם של השולח השני התגובה שלו.. בסיסי
אבל בלי mySQL
אני רוצה שהוא יכניס את הנתונים לקובץ טקסט
זה הקוד שהכנתי עד עכשיו:
<?php
$file_loc="Comments.txt";
$name=$_POST["name"];
$comment=$_POST["comment"];
if($name=="") {
$name="noname";
}
$commentArr[0][0]=$name;
$commentArr[0][1]=$comment;
$arr=file($file_loc);
$file=fopen($file_loc,"w++");
for($i=1;$i<=count($arr);$i++){
echo $i;
$arr[$i]=rtrim($arr[$i]);
$ex=explode(":",$arr[$i]);
$commentArr[$i][0]=$ex[0];
$commentArr[$i][1]=$ex[1];
}
$string="";
$fileString="";
$i=0;
while($i<10 && $i<count($commentArr)){
$string.="name$i=".$commentArr[$i][0]."&";
$string.="score$i=".$commentArr[$i][1]."&";
$fileString.=$commentArr[$i][0].":".$commentArr[$i][1];
if($i!=count($commentArr)-1) {
$fileString.="\n";
$i++;
}
fwrite($file,$fileString);
fclose($file);
echo $string;
echo nl2br($fileString);
?>
הוא רושם לי שגיאה.. אבל מוזרה כי הוא מתייחס בה אל הסוף של הקוד ?>
אם מישהו יוכל לומר לי למה יש שגיאה או איך אני מתקן את זה אני הודה לו מאוד.
נערך לאחרונה ע"י zoomby בתאריך 14-03-2006 בשעה 00:56.
|