iSelfSchooling.com - Copyright © 1999-2007 iSelfSchooling.com  References  Job Openings  |  Secure Login
    Home  | Search more...  |  FREE Online VIDEO Oracle Training  |  Gift Store  |  Bookstore

   Unlimited access!   

    Oracle  Syntax  | Suggestions Your Contribution  |  FREE Legal Forms

 

Email2aFriend Homepage us! |  Bookmark   -  Copyright & User Agreement

Products/Services

 Vision/Mission

 Community Sharing

 Services

  Products

 Biography

 Contact Us

 FAQ

 Current News

 Website Traffic

 Bookstore

 FREE Training

 SQL

 PL/SQL

 Forms 

 Reports

 Other TOOLS

 Fundamentals

 Performance

 OEM

 Application Server

 Grid Control

 Articles

 Prepare for OCP

Oracle SYNTAX

 Oracle Functions

 Oracle Syntax

 Oracle 10g Syntax

  PL/SQL Syntax

UNIX and more...

 UNIX for DBAs

 LINUX for DBAs

 DB using PHP

  A+ Certification

 Basics of JAVA  

 Tips of  SEO

Finance/Jobs

 Financial Aid

 Skilled

 Oracle

 Jobs

  Magazine

More Training

 Q & Answers

 SQL-PL/SQL

 DBA

 Developer

 Important Notes

 Case Studies

 9i New Features

 10g New Features

 10g Qs/As

 Grid Control

 OracleAS # I

 OracleAS # II

  LDAP and OID

  HTTP Server

 Instructor-Led

  Virtual Hosts

 Community Sharing

More to know...

Acknowledgement**

 FREE Legal Forms

 Who is who

 Market Place

 University Directory

 Advisory Articles

 Links...

 

 

How to use read or write to Oracle, SQLServer, MySQL, or other databases in PHP?

More Resources by Google:

How to use read or write to Oracle, SQLServer, MySQL, or other databases in PHP?


To get more information about SQL go to www.mysql.com <http://www.mysql.com> , www.oracle.com <http://www.oracle.com> , www.phpmyadmin.net <http://www.phpmyadmin.net> and more. The www.iselfschooling.com <http://www.iselfschooling.com> website is the best website that will teach you how to write a SQL statement step by step. It has a movie that you can play and watch. All their training courses are downloadable.

The following PHP script is an example of how to connect and insert a record into a database (MySQL DBMS). The same concept can be used for Oracle, SQLServer and other databases.
We assume that you know SQL statement. If you want to learn more about the SQL statement and its syntax, please go to www.iselfschooling.com <http://www.iselfschooling.com> with lots of examples and FREE tutorial pages.

In this example, we display and handle the HTML form in the same script. We add a record to the “customer” table, and then we display the added record. It contains three columns such as customer_id, customer_name, and customer_address. We call this script “database_transaction.php.”


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitionl.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>An example of database transaction in PHP.</title>
</head>

<body>

<?php // database_transaction.php
init_set(‘display_errors’,1); // turn on my display error option
error_reporting(E_ALL); // Turn on all the errors 

if (isset ($_POST[‘submit’])) { // if the user submit the form then
if ($db_connect = @mysql_connect (‘your-hostname’,’username’,’password’)) { 
if (!@mysql_select_db 


// if can you connect, then add a record.
$transaction = “INSERT INTO customer 
(customer_id, customer_name, customer_address)
VALUSE (100, ‘{$_POST[‘customer_id’]}’,
‘{$_POST[‘customer_name’]}’,
‘{$_POST[‘customer_address’]}’);
// execute transaction.
if (@mysql_query ($transaction)) { 
print ‘<p>Record was added successfully.</p>’;
} else {
print “<p>Record was not added because, <b>” . mysql_error() . “</b>”;
}

Mysql_close(); // close the database.
}
}
?>

<form action=”database_transaction.php” method=”post”>
<p>Enter Customer ID: <input type=”text” name=”customer_id” size=”10” maxsize=”10” /></p>
<p>Enter Customer Name: <input type=”text” name=”customer_name” size=”10” maxsize=”100” /></p>
<p>Enter Customer address: <input type=”text” name=”customer_address” size=”10” maxsize=”100” /></p>
<input type=”submit” name=”submit” value=”Add customer.” />
</form>

</body>
</html>

 

 

 
 
Google
 
Web web site