< 1 2 3 4 5 6 7 > >>   Sort: Date

Variables in Double Quoted Strings
Would I use print "$a dollars" or "{$a} dollars" to print out the amount of dollars in this example? In this example, "$a dollars" or "{$a} dollars" will print the same result. But in other cases, you need to use curly braces to protect variable names. For example, for following PHP script will prin...
2007-02-27, 6461👍, 0💬

Number of Days between Two Dates
How can we know the number of days between two given dates in PHP? Simple arithmetic: &lt;?php $date1 = date('Y-m-d'); $date2 = '2006-07-01'; $days = (strtotime($date1) - strtotime($date2)) / (60 * 60 * 24); $days = (int) $days; echo "Number of days since '2006-07-01': $days"; ?&gt;
2007-02-27, 6424👍, 0💬

Executing a PHP Script Using Command Line
How can I execute a PHP script using command line? Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, "php myScript.php", assuming "php" is the command to invoke the CLI program. Be aware that if your PHP script was w...
2007-02-27, 6364👍, 0💬

How To Break Output into Pages
How To Break Output into Pages? - MySQL FAQs - Managing Tables and Running Queries with PHP Scripts If you have a query that returns hundreds of rows, and you don't want to present all of them to your users on a single page. You can break output into multiple pages, and only present 10 rows per page...
2007-05-10, 5838👍, 0💬

Persistent Cookies
What Is a Persistent Cookie? A persistent cookie is a cookie which is stored in a cookie file permanently on the browser's computer. By default, cookies are created as temporary cookies which stored only in the browser's memory. When the browser is closed, temporary cookies will be erased. You shoul...
2007-02-27, 5820👍, 0💬

How To Query Multiple Tables Jointly
How To Query Multiple Tables Jointly? - MySQL FAQs - Managing Tables and Running Queries with PHP Scripts If you want to query information stored in multiple tables, you can use the SELECT statement with a WHERE condition to make an inner join. Assuming that you have 3 tables in a forum system: "use...
2007-05-11, 5779👍, 0💬

What is PHP
What is PHP? The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications.
2007-02-27, 5718👍, 0💬

What Is a Session
What Is a Session? A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests. There is only one session object available to your PHP scripts at any time. Data saved to the session by a script can be retrieved by the same script or another s...
2007-02-27, 5601👍, 0💬

How To Update Existing Rows in a Table
How To Update Existing Rows in a Table? - MySQL FAQs - Managing Tables and Running Queries with PHP Scripts Updating existing rows in a table requires to run the UPDATE statement with a WHERE clause to identify the row. The following sample script updates one row with two new values: &lt;?php in...
2007-05-11, 5600👍, 0💬

define() - Defining Constants
How do you define a constant in PHP? You can define a constant by using the define() function. Once a constant is defined, it can never be changed or undefined. For example: &lt;?php define("CONSTANT", "Hello world."); echo CONSTANT; // outputs "Hello world." echo Constant; // outputs "Constant"...
2007-02-27, 5588👍, 0💬

require(), include() and include_once() Functions
What are the differences between require(), include() and include_once() functions in PHP? All three functions are used to include and evaluate a file into the current script execution. The include_once() statement includes and evaluates the specified file during the execution of the script. This is...
2007-02-27, 5584👍, 0💬

How To Quote Date and Time Values in SQL Statements
How To Quote Date and Time Values in SQL Statements? - MySQL FAQs - Managing Tables and Running Queries with PHP Scripts If you want to provide date and time values in a SQL statement, you should write them in the format of "yyyy-mm-dd hh:mm:ss", and quoted with single quotes ('). The tutorial exerc...
2007-05-11, 5574👍, 0💬

How To Perform Key Word Search in Tables
How To Perform Key Word Search in Tables? - MySQL FAQs - Managing Tables and Running Queries with PHP Scripts The simplest way to perform key word search is to use the SELECT statement with a LIKE operator in the WHERE clause. The LIKE operator allows you to match a text field with a keyword pattern...
2007-05-11, 5533👍, 0💬

How To Invoke a User Function
How To Invoke a User Function? - PHP Script Tips - Creating Your Own Functions You can invoke a function by entering the function name followed by a pair of parentheses. If needed, function arguments can be specified as a list of expressions enclosed in parentheses. Here is a PHP script example on h...
2007-04-24, 5526👍, 0💬

How To Convert Strings to Upper or Lower Cases
How To Convert Strings to Upper or Lower Cases? - PHP Script Tips - PHP Built-in Functions for Strings Converting strings to upper or lower cases are easy. Just use strtoupper() or strtolower() functions. Here is a PHP script on how to use them: &lt;?php $string = "PHP string functions are easy ...
2007-04-21, 5518👍, 0💬

How To Get the ID Column Auto-Incremented
How To Get the ID Column Auto-Incremented? - MySQL FAQs - Managing Tables and Running Queries with PHP Scripts Many tables require an ID column to assign a unique ID number for each row in the table. For example, if you have a table to hold forum member profiles, you need an ID number to identify ea...
2007-05-11, 5512👍, 0💬

How To Protect Special Characters in Query String
How To Protect Special Characters in Query String? - PHP Script Tips - Processing Web Forms If you want to include special characters like spaces in the query string, you need to protect them by applying the urlencode() translation function. The script below shows how to use urlencode(): &lt;?ph...
2007-04-22, 5476👍, 0💬

What Is PEAR
What Is PEAR? PEAR is the next revolution in PHP. This repository is bringing higher level programming to PHP. PEAR is a framework and distribution system for reusable PHP components. It eases installation by bringing an automated wizard, and packing the strength and experience of PHP users into a n...
2007-02-27, 5465👍, 0💬

How To Query Tables and Loop through the Returning Rows
How To Query Tables and Loop through the Returning Rows? - MySQL FAQs - Managing Tables and Running Queries with PHP Scripts The best way to query tables and loop through the returning rows is to run the SELECT statement with the mysql_query() function, catch the returning object as a result set, an...
2007-05-11, 5439👍, 0💬

Uploading Files with File Input Fields in a Form
How To Write the FORM Tag Correctly for Uploading Files? When users clicks the submit button, files specified in the &lt;INPUT TYPE=FILE...> will be transferred from the browser to the Web server. This transferring (uploading) process is controlled by a properly written &lt;FORM...> tag as: ...
2007-02-27, 5430👍, 0💬

Differences between Simple Variables and Variable Variables
What is the difference between $message and $$message in PHP? $message is a simple variable with a fixed name which is called "message". $$message is a variable variable with a variable name which is stored in another variable called $message. If $message contains "user", $$message is the same as $u...
2007-02-27, 5405👍, 0💬

How To Randomly Retrieve a Value from an Array
How To Randomly Retrieve a Value from an Array? - PHP Script Tips - PHP Built-in Functions for Arrays If you have a list of favorite greeting messages, and want to randomly select one of them to be used in an email, you can use the array_rand() function. Here is a PHP example script: &lt;?php $a...
2007-04-21, 5386👍, 0💬

Where Are the Persistent Cookies Stored on Your Computer
Where Are the Persistent Cookies Stored on Your Computer? - PHP Script Tips - Understanding and Managing Cookies The location and file names where persistent cookies are stored on your computer depend on which browser you are using. If you using Microsoft Internet Explorer, persistent cookies are st...
2007-04-24, 5371👍, 0💬

How To Quote Text Values in SQL Statements
How To Quote Text Values in SQL Statements? - MySQL FAQs - Managing Tables and Running Queries with PHP Scripts Text values in SQL statements should be quoted with single quotes ('). If the text value contains a single quote ('), it should be protected by replacing it with two single quotes (''). In...
2007-05-11, 5335👍, 0💬

< 1 2 3 4 5 6 7 > >>   Sort: Date