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 serializable?
What is importing utility?
What are the benefits and tasks of object explorer? : sql server management studio
What are trace flags and mention a few common trace flags used with sql server?
Explain Normalization and DE normalization
Explain the properties of the relational tables?
What is dbcc updateusage?
What is database architecture? : SQL Server Architecture
List types of tables in SQL Azure?
How do I setup a local sql server database?
Explain the disadvantages of cursors?
What is sql server query analyzer?
What is a partition function in sql server?
How to create an inline table-valued function?
What is difference between getdate and sysdatetime in sql server 2008?