Blog Archives

PHP file fgets

The fgets() function is used to read a single line from a file. After a call to this function the file pointer has moved to the next line. If you had separated your data with new lines then you could

Posted in Php

PHP file fread

Before we can read information from a file we have to use the function fopen to open the file for reading. The fread function is the staple for getting data out of a file. The function requires a file handle,

Posted in Php

PHP File Write

The fwrite() function is a main function that is used to write something into files. This function returns the number of bytes written, or FALSE on failure. Syntax fwrite($file,$string,$length) $file – Required. Specifies the open file to write to $string

Posted in Php

Some useful php functions

* strstr() – for finding string within a string in PHP * eval() – function evaluates a string as PHP code * reset() – function points the internal cursor position at first element of array. * list() – function is

Posted in Php

PHP and AJAX

AJAX Introduction Ajax stands for Asynchronous JavaScript and XML. AJAX is about updating parts of a web page, without reloading the whole page. Ajax is not an Technology in itself. It is a term used for representing the technique used

Posted in Php

PHP MySQL Connect to a Database

Connect to MySQL Database Opening a connection to MySQL database from PHP is easy. Just use the mysql_connect() function like this, Syntax mysql_connect(servername,username,password); servername = Specifies the server to connect to. Default value is “localhost:3306” username = Specifies the username

Posted in Php

PHP E-mail

PHP allows you to send e-mails directly from a script. The PHP mail() function is used to send emails from inside a script. Syntax mail($to, $subject, $message, $headers); As you can see above, the mail function has four parameters. *

Posted in Php

PHP Sessions

Sessions are used to store information which can be used through-out the application for the entire time the user is logged in or running the application. Each time a user visits your website, you can create a session for that

Posted in Php

PHP Cookies

Cookies allow the webmaster to store information about the site visitor on their computer to be accessed again the next time they visit. Syntax The setcookie() function is used to set a cookie. Note: The setcookie() function must appear BEFORE

Posted in Php

PHP File Upload

PHP is its ability to manage file uploads to your server. To allow users to upload a file to the server, you first need to provide a form for them to specify which file they want to upload. Once they

Posted in Php