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

What are subqueries in sql server?

0 Answers  


Explain how long are locks retained within the repeatable_read and serializable isolation levels, during a read operation with row-level locking?

0 Answers  


what is the query and condition to delete datas in sql server.

2 Answers  


what is bit datatype? : Sql server database administration

0 Answers  


Explain in brief about Microsoft SQL server?

0 Answers  






How to change the ownership of a schema in ms sql server?

0 Answers  


What are the differences between local and global temporary tables?

0 Answers  


About DTS usage ?

2 Answers   Cognizant, Wipro,


Tell me what is difference between view and materialized view?

0 Answers  


Explain indexed view?

1 Answers  


What is difference statement and preparedstatement?

0 Answers  


What is a field in a table?

0 Answers  


Categories