<< < 6 7 8 9 10 11 12 13 14 > >>   Sort: Rank

Closing a Session Properly in PHP
How To Close a Session Properly in PHP? 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 = array(). Remove the session ID cookie with the s...
2016-10-22, 256👍, 0💬

Connecting to a MySQL Server in PHP
How To Connect to MySQL from a PHP Script in PHP? If you want access the MySQL server, you must create a connection object first by calling the mysql_connect() function in the following format: $con = mysql_connect($server, $username, $password); If you are connecting to a local MySQL server, you do...
2016-10-20, 473👍, 0💬

Selecting an Existing Database in PHP
How To Select an Exiting Database in PHP? The first thing after you have created a connection object to the MySQL server is to select the database where your tables are locate, by using the mysql_select_db() function. If your MySQL server is offered by your Web hosting company, they will assign a da...
2016-10-20, 467👍, 0💬

Inserting Rows Based on SELECT Statement in PHP
How To Insert Rows Based on SELECT Statements in PHP? If want to insert rows into a table based on data rows from other tables, you can use a sub-query inside the INSERT statement as shown in the following script example: <?php include "mysql_connection.php"; $sql = "INSERT INTO fyi_links" . " SE...
2016-10-20, 456👍, 0💬

Creating a Table in PHP
How To Create a Table in PHP? If you want to create a table, you can run the CREATE TABLE statement as shown in the following sample script: <?php include "mysql_connection.php"; $sql = "CREATE TABLE fyi_links (" . " id INTEGER NOT NULL" . ", url VARCHAR(80) NOT NULL" . ", notes VARCHAR(1024)" . ...
2016-10-20, 283👍, 0💬

Creating a Database in PHP
How To Create a Database in PHP? 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 the administrator of the server, you can create and delete databases using the CREATE/DROP DATABASE statements. The following PHP script sho...
2016-10-20, 263👍, 0💬

What Is a Result Set Object in PHP
What Is a Result Set Object in PHP? A result set object is a logical representation of data rows returned by mysql_query() function on SELECT statements. Every result set object has an internal pointer used to identify the current row in the result set. Once you get a result set object, you can use ...
2016-10-20, 262👍, 0💬

Number of Rows Affected by a SQL Statement in PHP
How To Get the Number of Rows Selected or Affected by a SQL Statement in PHP? There are two functions you can use the get the number of rows selected or affected by a SQL statement: mysql_num_rows($rs) - Returns the number of rows selected in a result set object returned from SELECT statement. mysql...
2016-10-20, 262👍, 0💬

Running a SQL Statement in PHP
How To Run a SQL Statement in PHP? You can run any types of SQL statements through the mysql_query() function. It takes the SQL statement as a string and returns different types of data depending on the SQL statement type and execution status: Returning FALSE, if the execution failed. Returning a re...
2016-10-20, 253👍, 0💬

Information Needed for MySQL Connection in PHP
What Do You Need to Connect PHP to MySQL in PHP? If you want to access MySQL database server in your PHP script, you need to make sure that MySQL module is installed and turned on in your PHP engine. Check the PHP configuration file, php.ini, to make sure the extension=php_mysql.dll is not commented...
2016-10-20, 250👍, 0💬

Inserting Data into a Table in PHP
How To Insert Data into a Table in PHP? If you want to insert a row of data into a table, you can use the INSERT INTO statement as shown in the following sample script: <?php include "mysql_connection.php"; $sql = "INSERT INTO fyi_links (id, url) VALUES (" . " 101, 'dev.fyicenter.com')"; if (mysq...
2016-10-20, 244👍, 0💬

Quoting Date and Time Values in PHP
How To Quote Date and Time Values in SQL Statements in PHP? 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 exercise below shows you two INSERT statements. The first one uses...
2016-10-19, 453👍, 0💬

Updating Existing Rows in PHP
How To Update Existing Rows in a Table in PHP? 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: <?php include "mysql_connection.php"; $sql = "UPDATE fyi_links SET notes=...
2016-10-19, 257👍, 0💬

Quoting Text Values in PHP
How To Quote Text Values in SQL Statements in PHP? 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 SQL language syntax, two single quotes represents one single...
2016-10-19, 255👍, 0💬

Looping through Returning Rows from a Query in PHP
How To Query Tables and Loop through the Returning Rows in PHP? The best way to query tables and loop through the returning rows is to run the SELECT statement with the catch the mysql_query() function, catch the returning object as a result set, and loop through the result with the mysql_fetch_asso...
2016-10-19, 253👍, 0💬

Deleting Existing Rows in PHP
How To Delete Existing Rows in a Table in PHP? If you want to remove a row from a table, you can use the DELETE statement with a WHERE clause to identify the row. The following sample script deletes one row: <?php include "mysql_connection.php"; $sql = "DELETE FROM fyi_links WHERE id = 1102"; if ...
2016-10-19, 244👍, 0💬

Uploading Files to Web Servers in PHP
Where to find tutorials on how to upload files to Web servers in PHP? A collection of tutorials to answer many frequently asked questions on how to upload files to Web servers in PHP. Clear explanations and tutorial exercises are provided on creating file upload HTML tags, setting encoding type on H...
2016-10-17, 282👍, 0💬

Querying Multiple Tables Jointly in PHP
How To Query Multiple Tables Jointly in PHP? 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: "users" for user profile, "forums" for forums information, and "p...
2016-10-17, 256👍, 0💬

INPUT Tag for File Uploading in PHP
Which HTML Tag Allows Users to Specify a File for Uploading in PHP? To present an input field on your Web page to allow users to specify a local file to upload, you need to use the <INPUT TYPE="FILE" ...> tag inside a <FORM ...> tag. The <INPUT TYPE="FILE" ...> will be displayed as...
2016-10-17, 251👍, 0💬

Retrieving the Last Auto Increment ID in PHP
How To Get the Last ID Assigned by MySQL in PHP? If you use an ID column with AUTO_INCREMENT attribute, you can use the mysql_insert_id() function to get the last ID value assigned by the MySQL server, as shown in the sample script below: <?php include "mysql_connection.php"; $sql = "INSERT INTO ...
2016-10-17, 251👍, 0💬

Setting ID Column as Auto-Incremented in PHP
How To Set the ID Column as Auto-Incremented in PHP? 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 each member. To allow MySQL server to automatically assign a...
2016-10-17, 250👍, 0💬

FORM Tag for Uploading Files in PHP
How To Write the FORM Tag Correctly for Uploading Files in PHP? When users clicks the submit button, files specified in the <INPUT TYPE=FILE...> will be transferred from the browser to the Web server. This transferring (uploading) process is controlled by a properly written <FORM...> tag...
2016-10-17, 247👍, 0💬

Processing Uploaded Files in PHP
How To Process Uploaded Files in PHP? How to process the uploaded files? The answer is really depending on your application. For example: You can attached the outgoing emails, if the uploaded files are email attachments. You can move them to user's Web page directory, if the uploaded files are user'...
2016-10-17, 246👍, 0💬

What Is File Upload in PHP
What Is File Upload in PHP? File upload is Web page function which allows visitor to specify a file on the browser's system and submit it to the Web server. This is a very useful function for many interactive Web sites. Some examples are: Web base email systems for users to send attachments. Forums ...
2016-10-17, 244👍, 0💬

<< < 6 7 8 9 10 11 12 13 14 > >>   Sort: Rank