how we can use a database with php.

Answers were Sorted based on User's Feedback



how we can use a database with php...

Answer / narayana

no idea because its a seperate software

Is This Answer Correct ?    1 Yes 1 No

how we can use a database with php...

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

Post New Answer

More SQL Server Interview Questions

Explain system functions or built-in functions? What are different types of system functions?

0 Answers  


What do we need queues in sql service broker?

0 Answers  


What is the difference between push and pull subscription? : sql server replication

0 Answers  


wat is mean by trigger?.......normally wat use......when trigger used in sql........... plz cleary say with example.......

2 Answers   TCS, Wipro,


Does partitioning ssd reduce performance?

0 Answers  






what is an extended stored procedure? Can you instantiate a com object by using t-sql? : Sql server database administration

0 Answers  


What is the difference between online clustering and Offline clustering?

0 Answers   IBM,


On a windows server 2003 active – passive failover cluster, how do you find the node which is active?

0 Answers  


What are the different types of collation sensitivity?

0 Answers  


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?

0 Answers  


How do I edit a procedure in sql server?

0 Answers  


Categories