|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
writing to a file...
<?php
if(isset($_GET['newun'])) { if(file_exists($_GET['newun'].'.txt')) { echo 'Username already exists'; } else { $file = fopen($_GET['newun'].".txt","w"); fwrite($file,"$username = "$_GET['newun']"\n $password = "$_GET['newpw']); fclose($file); echo 'Account Created Successfully'; } } ?> Im trying this code but it gives me a 'parse error' at line 8. at fwrite(). How can i break out of the quotes, do some php, then back into the quotes again? |
|
#2
|
|||
|
|||
|
You need to use the "." operator to concatenate strings. For example -
PHP Code:
Will echo "hello world!". Hope this helps, -KM- |
|
#3
|
||||
|
||||
|
Looks to me he did that, KM, check line 7.
The problem is in the non-escaped double quotes in line 8. Put a '\' in front of them, and it should work, Line should then look like this: PHP Code:
|
|
#4
|
|||
|
|||
|
Ah good point, I misread what the quotes were doing on that line and thought he was breaking out of quotes to use a variable.
-KM- |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > writing to a file... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|