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 what is the use of custom fields in report?

0 Answers  


What are system databases into sql server (2005/2008)?

0 Answers  


What is an identity?

0 Answers  


Does group by or order by come first?

0 Answers  


How to create an index on an existing table in ms sql server?

0 Answers  






How will you fine tune a stored procedure or what are the steps that should be taken to fine tune or optimize a stored procedure?

1 Answers   Logitech, Mphasis,


When a primary key constraint is included in a table, what other constraints does this imply?

0 Answers  


How can we write or define DDL statements in Sql server and DML statements?

3 Answers  


Can you explain different types of locks in sql server?

0 Answers  


What is update locks?

0 Answers  


What is log shipping? Can we do logshipping with SQL Server 7.0 - Logshipping is a new feature of SQL Server 2000. We should have two SQL Server - Enterprise Editions. From Enterprise Manager we can configure the logshipping. In logshipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db and we can use this as the DR (disaster recovery) plan.

0 Answers  


how many bits ip address consist of? : Sql server database administration

0 Answers  


Categories