Pipes Posted October 6, 2006 Share Posted October 6, 2006 Hello: I'm a complete novice trying to split a file of quotations into quotes and authors (it's a .txt file). I've written this short simple script but i'm getting an error message.[code]$quotestxt = '$DOCUMENT_ROOT/quotes.txt';$quotes_file = fopen($quotestxt, 'r+');while (fread($quotes_file, 1024)) { $pattern = '^[\"]'; $quote_roster = preg_match($pattern, $quotes_file); print_r($quote_roster);}[/code]Th error message is telling me: Parse error: parse error, unexpected T_VARIABLE in C:\XXXX\separate_quotes_from_authors.php on line 15can anyone tell me what I should looking for? i've tried the manual, but I can't seem to help myself. It's driving me mad!any help appreciated!Pipes Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 6, 2006 Share Posted October 6, 2006 Which is line 15?Also, you want to use double quotes instead of single quotes on this line:[code]<?php $quotestxt = '$DOCUMENT_ROOT/quotes.txt'; ?>[/code]Ken Quote Link to comment Share on other sites More sharing options...
Pipes Posted October 7, 2006 Author Share Posted October 7, 2006 Thanks Ken: sorry should have mentioned line 15 is the one that begins$quotestxt = '$DOCUMENT_ROOT/quotes.txt';I have now changed this to double quotes, but the problem persists.The location and path is correct (I created a short variable name for the server path above this code.) so I don't know what variable problems to be looking for??Thanks for trying to help. best, Andy Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 7, 2006 Share Posted October 7, 2006 Use the full url of the document_rootexample$quotestxt = "folder_name/quotes.txt";[code]<?php$quotestxt = "$DOCUMENT_ROOT/quotes.txt";$quotes_file = fopen($quotestxt, 'r+');while (fread($quotes_file, 1024)) { $pattern = '^[\"]'; $quote_roster = preg_match($pattern, $quotes_file); print_r($quote_roster);}?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.