Establishing a Connection to MySql in PHP January 6, 2013 Establishing a Connection to MySql using PHP: <? $connection = @mysql_connect(“localhost”, “root”, “root”) or die(mysql_error()); if($connection) { echo “Connection success!”; } ?> Continue Reading
Uploading Files to Your Web Site January 6, 2013 Creating the Form: Start out by creating a one-field form. You can create a form to upload as many files as you like after… Continue Reading
Delete Files in PHP January 6, 2013 Deleting Files:Be very careful when using the unlink() function because once you’ve deleted a file, it’s gone for good. Example:<?php$new_file = “e:/ashu.txt”;$success = unlink($new_file)… Continue Reading
Rename Files in PHP January 6, 2013 Renaming Files:Like the copy() function, the rename() function just needs to know the original filename and a new filename. In this case, you’re just… Continue Reading
Copying Files in PHP January 6, 2013 Copying Files in PHP: The copy() function is very simple: It needs to know the original filename and a new filename, and that’s all there… Continue Reading
Read Data from File with Proper New Line January 6, 2013 Read Data from File with proper New Line : That’s definitely the string written to the file, but what happened to that line break?… Continue Reading
Read Data from File January 6, 2013 Read Data from File: <?php$filename = “e:/readdata.txt”;$myfile = fopen($filename, “r”) or die(“Unable to open file”);$showfile = fread($myfile, filesize($filename));$showfile = “<br>$showfile<br/>”;$msg = “The file contents… Continue Reading
Append a File in PHP January 6, 2013 Append a File in PHP:<?php$filename = “e:/appendfile.txt”;$writetext = “My First filenHi world I am ASHISH PRAJAPATI”;$writefile = fopen($filename,”a+”) or die(“unable to create file”);fwrite($writefile, $writetext)… Continue Reading
Create a New File in PHP January 5, 2013 Create a New File in PHP: <?php$filename = “e:/ashu.txt”;if(file_exists($filename)){$msg = “file already exists”;}else{$newfile = fopen($filename, “w+”) or die(“Unable to create file”);fclose($newfile);$msg = “<p>file created</p>”;}?><html><head><title>Creating… Continue Reading
Working With fopen and fclose in PHP January 4, 2013 Working with fopen() and fclose() Before you jump headfirst into working with files, you need to learn a bit about the fopen() function, which… Continue Reading