Answer the question
In order to leave comments, you need to log in
How to correctly display information from an array?
Hello.
I apologize in advance for stupid questions, I'm studying php for the fourth day.) I'm trying to get the Telegram id of all bot visitors .. that's what happened
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
$bd = new PDO('mysql:dbname=testbd;host=localhost', 'testbduser', 'G9yR37', array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
function user() {
global $bd;
$stmt = $bd->query("SELECT `tg_id` FROM `user`");
$data = $stmt->fetchAll();
return $data;
}
$datas = user();
foreach ($datas as $value) {
echo "<b>$value</b><br>";
}
//$message = "Test rassilki";
//sendTg($message);
// function sendTg($message){
// $tokken = "111081012:AAF5DzPQ4bjxO94BWvGM_JDiey_fqgiKE"; // токен бота
// $filename = "https://api.telegram.org/bot".$tokken."/sendMessage?chat_id=".$value."&text=".urlencode($message)."&parse_mode=html";
// file_get_contents($filename);
// }
?>
Notice: Array to string conversion in /var/www/www-root/data/www/domain.com/1.php on line 19
Array
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question