how we can use a database with php.
Answers were Sorted based on User's Feedback
Answer / 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 |
Explain system functions or built-in functions? What are different types of system functions?
What do we need queues in sql service broker?
What is the difference between push and pull subscription? : sql server replication
wat is mean by trigger?.......normally wat use......when trigger used in sql........... plz cleary say with example.......
Does partitioning ssd reduce performance?
what is an extended stored procedure? Can you instantiate a com object by using t-sql? : Sql server database administration
What is the difference between online clustering and Offline clustering?
On a windows server 2003 active – passive failover cluster, how do you find the node which is active?
What are the different types of collation sensitivity?
Difference between sql server 2000 and sql server 2005?
11 Answers Aditi Tech, eInfochips, GE, HCL, IBM, Masim Infotech, NIIT, Satyam, Systems Domain,
What are the different types of triggers in SQL SERVER?
How do I edit a procedure in sql server?