pdo

The PDO execute() method doesn't work, and it doesn't throw any errors

Hi everyone, heh. In general, if it is not difficult to tell me what the problem may be, the execute method does not save any ... RAM_INT); if ($result->execute()) { return $db->lastInsertId(); } return 0; }

How to handle PHP PDO responses correctly?

Help me figure out how to tell the PDOStatement object that it would give an array with SELECT, SHOW, DESCRIBE or EXPLAIN, an ... ;fetch( PDO::FETCH_ASSOC ) ){ $response->rows[] = $row; } return $response; } } Thank you for your answers.

Do prepared expressions/variables completely protect against SQL injection?

The world has long used mysqli and PDO. Many people actively promote them: there are prepared variables, everything becomes s ... it does, then... I'm shocked)) P.S. Perhaps this question has already been considered, I don't know, I'm sorry in advance.

fetchAll associative array()

There is a function that returns an associative array: public function getSports(): array { $sql = 'SELECT id, n ... y id and name? P.s. I read the documentation, it seems that you need to pass constants to fetchAll(), but I didn't find any.

Error in PDO Invalid parameter number

In general, I work with PDO recently and have already broken the govolu to understand I can't understand what the error is he ... rver\\d...') #3 {main} thrown in D:\OpenServer\domains\InterMag.ru\model\model.php on line 138 Tell me where the error is??

Is not allowed to connect to this MariaDB server

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1130] Host 'xxx.xxx.xxx.xxx' is not all ... up? All rights to the user for remote connections are given, through Mysql Workbrench is normally connected. XAMPP server.

Output of the table contents from the database to the Html table

Good afternoon! I'm trying to output data from the database to an html table. There is a table The output code itself: ` ... esult, for some reason, the values are output 2 times. In addition, since you are not very familiar with Pdo, criticize it.

Competent protection against SQL-Injection

For a long time I have been tormented by the question: How to protect your site from SQL-Injection. In the old days, I used ... atabase data " , the connection is the same as specified in the article. How can you protect yourself from these injections?

Why doesn't PDO escape the quotes?

$sql = 'INSERT INTO `sell`.`themes` (`name`, `preview`, `them`, `price`, `create_at`) VALUES (?, ?, ?, ?, NOW())'; $pdo->p ... ariables have quotes, they are inserted into the database without escaping, is this normal? Here is a screenshot from PMA

Error connecting to PDO: php network getaddresses: getaddrinfo failed

Salute people, krch I do not want to connect... Mysql.php <? class Mysql { private $db; private $config; ... market\core\mysql.php on line 9 Fatal error: in E:\OpenServer\OpenServer\domains\blackmarket\core\mysql.php on line 9

How to pass $pdo to a model function

I have a folder config where the file is locateddb.php, which contains the following code: <?php $host = 'localhost'; $d ... on functions, like page loading and template loading. So: how do I properly initialize the PDO and connect it to the model?

Delete an entry from the sql table when you click on the link and change the status of sending a form with checkboxes

Hello, friends. I can't figure out how to delete one record from the table by id when clicking on the "Delete" button <td& ... ert("Запись НЕ добавлена в список дел! Попробуйте еще");</script>'; } } ?> </body> </html>

How to correctly insert a table name from a variable into an SQL query? PHP/PDO

It is impossible to bind, and PDO has no analogues mysql_real_escape_string(). Would it be correct to use PDO::quote() ? "SELECT * FROM" . $pdo->quote( $table ) ."; Or what to do in this case?

ORDER BY IN PDO

There is such a code: ... function pdq($sql, $params = array()) { global $pdo; $stmt = $pdo->prepare($sql); $stmt->exe ... orresponding "pole", in the above code, for some reason always gets the value from the text1 field. What could be the reason?

Not correctly executing a MySQL query, via PDO

I just started learning PDO, but that's not the point, it's that I don't know where and why I'm not executing a MySQL query c ... FederatedX pluggable storage engine Aria Crash-safe tables with MyISAM heritage I use free web hosting...

Checking the" Is the table empty? " PDO

I ran into a problem. How do I check if the table is empty? Via PDO

SQLSTATE[42000]: Syntax error or access violation: 1064

I am having difficulty viewing and inserting the data into the database, it is giving this error: SQLSTATE[42000]: Synta ... td> </tr> </table> </div><!--container--> <?php include_once 'footer.php';?>

Problems with PDO class not found

I am studying a book in which I have to perform some queryes through a design pattern TableDataGateway but I am getting the f ... $conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); return Produto::setConnection($conn); } }

pdo UPDATE does not work

I'm trying to send some values to SQL, but PDO doesn't work as it should, or I'm forgetting something, I'm new to using PDO. ... y? Maybe this post here from SO-pt will help. @Edit Error note: I cannot use placeholders to name tables or columns.

Error Object of class stdClass could not be converted to string

Well I'm with an object ' X ' that one of its properties is a JSON. This JSON contains the column name and column value respe ... T_SINCR] => N [COD_IDULT_ATUAL] => -1 [DAT_ULTIM_ATUAL] => 2015-11-05 09:13:56 ) )