sanauk
1
why show not connected in my phpdatabase. why is my incorrect? my database code are
<?php
$host="sql204.epizy.com";
$user="epiz_20646895";
$pass=" ";
$db="epiz_20646895_reg";
$con=mysqli_connect($host,$user,$pass,$db);
if(!$con)
{
print("Not Connected
".mysql_error());
}
else
{
//echo("Connected");
}
?>
please help me
@sanauk said:
why
it depends. but try the following code:
<?php
$server = "sqlXXX.epizy.com";
$user = "epiz_XXXXXXXX";
$pass = "XXXXXXXX";
$database = "epiz_XXXXXXXX_YYYY";
$db = new \\PDO( "mysql:host=$server;port=3306;dbname=$database;charset=utf8", $user, $pass );
$sth = $db->prepare( "select 'this comes from mysql' as response" );
$sth->execute();
$data = [];
while ( $row = $sth->fetch( PDO::FETCH_ASSOC ) )
$data[] = $row;
print_r($data);
just replace the first 3 variables with the data provided in your CP and the 4th line with the database name you should have created.
until you make it work, keep fiddling with the variables. once it works for you, check your own code for whatโs missing.