Write the statements that are used to connect PHP with MySQL
Page 1 of 1
Write the statements that are used to connect PHP with MySQL
The statements that can be used to connect PHP wil MySQL is:
<?
$conn = mysql_connect('localhost');
echo $conn;
?>
This statement gets the resource of the localhost. There are other different ways with which you can connect to the database and they are as follows:
<?
mysql_connect('db.domain.com:33306','root','user');
mysql_connect('localhost:/tmp/mysql.sock');
mysql_connect('localhost','rasmus','foobar',
true,MYSQL_CLIENT_SSL|MYSQL_CLIENT_COMPRESS);
?>
Similar topics
» What are the different types of statements that are present in PHP?
» Write a Hello world program using variable?
» Write a program to show the joining of two strings in PHP?
» Write a statement to show the joining of multiple comparisons in PHP?
» How to use HTTP Headers inside PHP? Write the statement through which it can be added?
» Write a Hello world program using variable?
» Write a program to show the joining of two strings in PHP?
» Write a statement to show the joining of multiple comparisons in PHP?
» How to use HTTP Headers inside PHP? Write the statement through which it can be added?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum