Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
How can we connect to a MySQL database from a PHP script?
Home
PHP
How can we connect to a MySQL database from a PHP script?
0
votes
asked
Jun 22, 2019
in
PHP
by
SakshiSharma
How can we connect to a MySQL database from a PHP script?
#php
#php-php
#php-server-monitor-script
#php-support
#mysql-php
#php-programmer
#php-development
#php-language
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jun 22, 2019
by
john ganales
To be able to connect to a MySQL database, we must use mysqli_connect() function as follows:
<!--?php $database = mysqli_connect("HOST", "USER_NAME", "PASSWORD"); mysqli_select_db($database,"DATABASE_NAME"); ?-->
Related questions
0
votes
Q: How can we define a variable accessible in functions of a PHP script?
asked
Jun 22, 2019
in
PHP
by
SakshiSharma
#php
#php-php
#php-server-monitor-script
#php-support
#mysql-php
#php-programmer
#php-development
#php-language
0
votes
Q: How be the result set of Mysql handled in PHP?
asked
Jun 22, 2019
in
PHP
by
SakshiSharma
#php
#php-php
#php-server-monitor-script
#php-support
#mysql-php
#php-programmer
#php-development
#php-language
0
votes
Q: How can I display text with a PHP script?
asked
Jun 22, 2019
in
PHP
by
SakshiSharma
#php
#php-php
#php-server-monitor-script
#php-support
#mysql-php
#php-programmer
#php-development
#php-language
0
votes
Q: How is it possible to set an infinite execution time for PHP script?
asked
Jun 22, 2019
in
PHP
by
SakshiSharma
#php-php
#php-server-monitor-script
#php-development
#php-support
#mysql-php
#php-language
#php-programmer
#php
0
votes
Q: How is a constant defined in a PHP script?
asked
Jun 23, 2019
in
PHP
by
SakshiSharma
#php
#php-php
#php-server-monitor-script
#php-support
#mysql-php
#php-programmer
#php-development
#php-language
0
votes
Q: How can we determine whether a PHP variable is an instantiated object of a certain class?
asked
Jun 23, 2019
in
PHP
by
SakshiSharma
#php
#php-php
#php-server-monitor-script
#php-support
#mysql-php
#php-programmer
#php-development
#php-language
+1
vote
Q: How can we display information of a variable and readable by a human with PHP?How can we display information of a variable and readable by a human with PHP?
asked
Jun 22, 2019
in
PHP
by
SakshiSharma
#php
#php-php
#php-server-monitor-script
#php-support
#mysql-php
#php-programmer
#php-development
#php-language
0
votes
Q: How to run the interactive PHP shell from the command line interface?
asked
Jun 22, 2019
in
PHP
by
SakshiSharma
#php
#php-php
#php-server-monitor-script
#php-support
#mysql-php
#php-programmer
#php-development
#php-language
0
votes
Q: Explain how you can update Memcached when you make changes to PHP?
asked
Jun 23, 2019
in
PHP
by
SakshiSharma
#php
#php-php
#php-server-monitor-script
#php-support
#mysql-php
#php-programmer
#php-development
#php-language
0
votes
Q: How can PHP and Javascript interact?
asked
Jun 22, 2019
in
PHP
by
SakshiSharma
#php
#php-php
#php-server-monitor-script
#php-support
#mysql-php
#php-programmer
#php-development
#php-language
...