Closed MaiconKatty2 closed 2 years ago
yes you can use database try like this in your command file
$conn = mysqli_connect('hostname', 'user', 'password, 'db_name);
$idUser = $this->getMessage()->getFrom()->getId();
$fetchUser = mysqli_query($conn, "SELECT id FROM users WHERE user_id = $idUser LIMIT 1");
or you can customize it
Hello
You can add Custom Tables to the included Database
You will need the following Classes in your Command File
use Longman\TelegramBot\DB;
use Longman\TelegramBot\Exception\TelegramException;
use PDO;
use PDOException;
Then within the Command build your PDO syntax. There are many PDO Tutorials in the Internet
$pdo = DB::getPdo();
$sql = 'INSERT INTO `table_name` (chat) VALUES (:chat)';
$sth = $pdo->prepare($sql);
$sth->bindValue(':chat', $chat_id);
Olá
Você pode adicionar tabelas personalizadas ao banco de dados incluído
Você precisará das seguintes classes em seu arquivo de comando
use Longman\TelegramBot\DB; use Longman\TelegramBot\Exception\TelegramException; use PDO; use PDOException;
Em seguida, dentro do comando, construa sua sintaxe PDO. Existem muitos Tutoriais PDO na Internet
$pdo = DB::getPdo(); $sql = 'INSERT INTO `table_name` (chat) VALUES (:chat)'; $sth = $pdo->prepare($sql); $sth->bindValue(':chat', $chat_id);
Okay, thank you!
yes you can use database try like this in your command file
$conn = mysqli_connect('hostname', 'user', 'password, 'db_name); $idUser = $this->getMessage()->getFrom()->getId(); $fetchUser = mysqli_query($conn, "SELECT id FROM users WHERE user_id = $idUser LIMIT 1");
or you can customize it
Okay, thank you!
hello, how can I work with the database in this library? wanted to make a system that saves certain information in the database.
could you give an example of using PDO within this library? an example that executes a query that saves information... an example of how to call pdo in this library and pass a query...
:/