<< < 2 3 4 5 6 7 8 9 10 11 > >>   Sort: Date

How To Read a Text File into an Array
How To Read a Text File into an Array? - PHP Script Tips - Reading and Writing Files If you have a text file with multiple lines, and you want to read those lines into an array, you can use the file() function. It opens the specified file, reads all the lines, puts each line as a value in an array, ...
2007-04-22, 4708👍, 0💬

How To View Cookie Header Lines
How To View Cookie Header Lines? - PHP Script Tips - Understanding and Managing Cookies If you are interested to see the cookie header lines, or you are having trouble with your cookies and need to see the cookies to help debugging, you can run your script with PHP CGI interface in a command line wi...
2007-04-24, 4704👍, 0💬

How View the Content of a Cookie File
How View the Content of a Cookie File? - PHP Script Tips - Understanding and Managing Cookies Cookie files are normal text files. You can view them with any text editor. Follow the steps below to see what is in a cookie file created by your own PHP script. Copy the following sample script, setting_p...
2007-04-24, 4700👍, 0💬

How To Read One Character from a File
How To Read One Character from a File? - PHP Script Tips - Reading and Writing Files If you have a text file, and you want to read the file one character at a time, you can use the fgetc() function. It reads the current character, moves the file pointer to the next character, and returns the charact...
2007-04-22, 4696👍, 0💬

How To Remove the New Line Character from the End of a Text Line
How To Remove the New Line Character from the End of a Text Line? - PHP Script Tips - PHP Built-in Functions for Strings If you are using fgets() to read a line from a text file, you may want to use the chop() function to remove the new line character from the end of the line as shown in this PHP sc...
2007-04-22, 4695👍, 0💬

How Session IDs Are Transferred on Your Web Server
How Session IDs Are Transferred on Your Web Server? - PHP Script Tips - Understanding and Using Sessions As you know there are two options the PHP engine can use to transfer session IDs to the client browsers. But how to do know which option is your PHP engine is using? The PHP sample script will he...
2007-04-18, 4695👍, 0💬

How To Generate a Character from an ASCII Value
How To Generate a Character from an ASCII Value? - PHP Script Tips - PHP Built-in Functions for Strings If you want to generate characters from ASCII values, you can use the chr() function. chr() takes the ASCII value in decimal format and returns the character represented by the ASCII value. chr() ...
2007-04-21, 4694👍, 0💬

Where Are PHP Configuration Settings Stored
Where Are PHP Configuration Settings Stored? - PHP Script Tips - Downloading and Installing PHP PHP stores configuration settings in a file called php.ini in PHP home directory. You can open it with any text editor to your settings.
2007-04-22, 4693👍, 0💬

What Are the Options to Transfer Session IDs
What Are the Options to Transfer Session IDs? - PHP Script Tips - Understanding and Using Sessions Once a new session is created, its session ID must be transferred to the client browser and included in the next client request, so that the PHP engine can find the same session created by the same vis...
2007-04-18, 4692👍, 0💬

How To Uploaded Files to a Table
How To Uploaded Files to a Table? - PHP Script Tips - Uploading Files to Web Servers To store uploaded files to MySQL database, you can use the normal SELECT statement as shown in the modified processing_uploaded_files.php listed below: &lt;?php $con = mysql_connect("localhost", "", ""); mysql_s...
2007-04-19, 4691👍, 0💬

How Do You If a Key Is Defined in an Array
How Do You If a Key Is Defined in an Array? - PHP Script Tips - PHP Built-in Functions for Arrays There are two functions can be used to test if a key is defined in an array or not: array_key_exists($key, $array) - Returns true if the $key is defined in $array. isset($array[$key]) - Returns true if ...
2007-04-20, 4685👍, 0💬

How To Close MySQL Connection Objects
How To Close MySQL Connection Objects? - MySQL FAQs - PHP Connections and Query Execution MySQL connection objects created with mysql_connect() calls should be closed as soon as you have finished all of your database access needs by calling mysql_close($con) function. This will reduce the consumptio...
2007-05-10, 4683👍, 0💬

How To Set a Persistent Cookie
How To Set a Persistent Cookie? - PHP Script Tips - Understanding and Managing Cookies If you want to set a persistent cookie, you can use the setcookie() function with an extra parameter to specify its expiration time. To follow sample script sets 2 persistent cookies to be expired within 7 days: s...
2007-04-25, 4683👍, 0💬

How To Break a File Path Name into Parts
How To Break a File Path Name into Parts? - PHP Script Tips - Working with Directoris and Files If you have a file name, and want to get different parts of the file name, you can use the pathinfo() function. It breaks the file name into 3 parts: directory name, file base name and file extension; and...
2007-04-23, 4683👍, 0💬

How To Close a Session Properly
How To Close a Session Properly? - PHP Script Tips - Understanding and Using Sessions Let's say you site requires users to login. When a logged in user clicks the logout button, you need to close the session associated with this user properly in 3 steps: Remove all session values with $_SESSION = ar...
2007-04-17, 4681👍, 0💬

How To Loop through an Array without Using "foreach"
How To Loop through an Array without Using "foreach"? - PHP Script Tips - PHP Built-in Functions for Arrays PHP offers the following functions to allow you loop through an array without using the "foreach" statement: reset($array) - Moves the array internal pointer to the first value of the array an...
2007-04-14, 4681👍, 0💬

How To Replace a Substring in a Given String
How To Replace a Substring in a Given String? - PHP Script Tips - PHP Built-in Functions for Strings If you know the position of a substring in a given string, you can replace that substring by another string by using the substr_replace() function. Here is a PHP script on how to use substr_replace()...
2007-04-21, 4679👍, 0💬

How To Support Multiple Submit Buttons
How To Support Multiple Submit Buttons? - PHP Script Tips - Processing Web Forms Sometimes, you may need to give visitors multiple submit buttons on a single form to allow them to submit the form for different purposes. For example, when you show your customer a purchase order in a Web form, you may...
2007-04-22, 4671👍, 0💬

How To Turn On the Session Support
How To Turn On the Session Support? - PHP Script Tips - Understanding and Using Sessions The session support can be turned on automatically at the site level, or manually in each PHP page script: Turning on session support automatically at the site level: Set session.auto_start = 1 in php.ini. Turni...
2007-04-18, 4670👍, 0💬

How To Create a Database
How To Create a Database? - PHP Script Tips - Working with MySQL Database A database in a MySQL server is a logical container used to group tables and other data objects together as a unit. If you are a the administrator of the server, you can create and delete databases using the CREATE/DROP DATABA...
2007-04-18, 4670👍, 0💬

How To Get All the Values Out of an Array
How To Get All the Values Out of an Array? - PHP Script Tips - PHP Built-in Functions for Arrays Function array_values() returns a new array that contains all the keys of a given array. Here is a PHP script on how to use array_values(): &lt;?php $mixed = array(); $mixed["Zero"] = "PHP"; $mixed[1...
2007-04-21, 4668👍, 0💬

How To Retrieve Values from the Current Session
How To Retrieve Values from the Current Session? - PHP Script Tips - Understanding and Using Sessions If you know some values have been saved in the session by an other script requested by the same visitor, you can retrieve those values back by using the pre-defined associative array called $_SESSIO...
2007-04-18, 4666👍, 0💬

How To Run a PHP Script
How To Run a PHP Script? - PHP Script Tips - Downloading and Installing PHP A standard alone PHP script can be executed directly with the PHP Command Line Interface (CLI). Write the following script in a file called hello.php: &lt;?php echo "Hello world!"; ?&gt; This script can be executed b...
2007-04-22, 4664👍, 0💬

How To Send a Cookie to the Browser
How To Send a Cookie to the Browser? - PHP Script Tips - Understanding and Managing Cookies If you want to sent a cookie to the browser when it comes to request your PHP page, you can use the setcookie( ) function. Note that you should call setcookie() function before any output statements. The foll...
2007-04-25, 4659👍, 0💬

<< < 2 3 4 5 6 7 8 9 10 11 > >>   Sort: Date