+ 1
How can i to connect with mysql?
I need to do a formas using mysql
2 ответов
+ 1
make a new php file like this :
<?php
$connectionDB = array(
'IPaddress' => 'the ip address where your database is located',
'user' => 'root or whatever you want to access the database',
'password' => 'the database password',
'DBname => 'the name of the db You want to use' );
$ODBCconnection = @mysqli_connect ($ODBCconnection['IPaddress'],
$ODBCconnection['user'],
$ODBCconnect['password'],
$ODBCconnect['DBname'] );
if (!$ODBCconnection){
echo "Can't connect to the database, try latter."; die();
}
and then include it in every page that you need to make a database connection.
+ 1
<?php
define ('HOST','localhost');
define ('USER','Write your user name here');
define ('PASS','Write your pass word here');
define ('DTBS','Write your Database here');
$dbs_handle=@mysqli_connect(HOST,USER,PASS,DTBS);
if (!$dbs_handle)
@return Print('Can not connect to the database.');
# and then include it in every page that you need to make a database connection.
?>