how we can use a database with php.
Answer Posted / shrikant
mysql> CREATE DATABASE first_test;
Query OK, 1 row affected (0.31 sec)
mysql> USE first_test;
Database changed
mysql> CREATE TABLE people (
id int UNIQUE NOT NULL,
first_name varchar(40),
surname varchar(50),
PRIMARY KEY(id)
);
Query OK, 0 rows affected (0.24 sec)
mysql> INSERT INTO people VALUES(1,'Ann','Brache');
Query OK, 1 row affected (0.09 sec)
mysql> INSERT INTO people VALUES(2,'Narcizo','Levy');
Query OK, 1 row affected (0.02 sec)
mysql> INSERT INTO people VALUES(3,'Tony','Crocker');
Query OK, 1 row affected (0.00 sec)
Your table should now look as follows:
mysql> SELECT * FROM people;
+----+------------+---------+
| id | first_name | surname |
+----+------------+---------+
| 1 | Ann | Brache |
| 2 | Narcizo | Levy |
| 3 | Tony | Crocker |
+----+------------+---------+
and for connecting
<?php
$username = "username";
$password = "password";
$hostname = "localhost";
$dbh = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the log shipping?
What is the parse query button used for?
How to find Duplicate Records In table?
What is the rdl file?
Explain security with sql azure?
How do I find the default sql server instance?
What is BCP? When does it used in sql server 2012?
What are subqueries in sql server?
Explain error and transaction handling in sql server?
Write a SQL query in order to merge two different columns into single column?
How we create SQL Server 2005 Reporting Services ? Give me Sample
What is difference between views and tables?
What is trigger and different types of Triggers?
What is function of CUBE ?
What is provisioning, billing and metering, and connection routing concepts in the service layer?