Jump to content

error in writing file php

Recommended Posts

Parse error: syntax error, unexpected T_STRING, expecting '(' in /home/MyShell/public_html/GetTable.php on line 4
Can someone tell me what is wrong with the below code?
<?php// If file existsif file_exists("testFile.txt"); // Do somethingelse $ourFileName = "testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle);?>

Link to post
Share on other sites
if (file_exists("testFile.txt") );You might also consider using the 1-step file_get_contents or file_put_contents instead the the 3-step fopen, fwrite/fread, fclose.
Can you give me a sample code of the one step?
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...