There is a MySQL database, there is an html site, you need to withdraw from this database information, of course this is done through php. But nothing happens. The original Toolkit:
- ROSA Linux;
- Apache;
- php;
- MySQL;
Throw the code below:
The database is connected, everything is OK, the html it finds (the database name), but nothing displays.
$link = mysqli_connect('localhost','root','0000','html');
//test connection:
if(mysqli_connect_errno())
die('connection Error: '.mysqli_connect_error()); //or if(!$link) {..
else { //if successful
echo (mysql_error());
}
//mysql_set_charset('utf8_general_ci', $link);
$res = mysqli_query("SELECT * FROM `table`");
if($res) { //if the request is successful
while($row = mysqli_fetch_assoc($res)) {
//print how we need
print_r($row);
}
mysqli_free_result($res); //clear the memory occupied - it is no longer needed
}
mysqli_close($link);
php.net/manual/en/mysqli.set-charset.php - kavon.Murphy commented on July 9th 19 at 13:52