Questions tagged as 'pdo'

3
answers

System of categories and subcategories / infinite children

I'm building a system of infinite, simple categories and subcategories. I found a script on the internet that meets the requirements, but its customization and adaptation to my project made it almost unusable. I studied a simple structure and...
asked by 14.04.2014 / 01:31
3
answers

Upload content automatically by the end of the page

I want to do an automatic type pagination of Facebook, which when it reaches the bottom of the page it automatically loads another page with more posts. I've already researched the subject and found nothing that could really help me to the point...
asked by 16.06.2014 / 21:49
2
answers

Rescuing the last insert in the database with PDO lastInsertId

I'm trying to redeem the last id on the bank with lastInsertId() of the PDO, but nothing appears. OBS: I'm using Postgre. <?php try { $dbh = new PDO('pgsql:host=localhost;port=5432;dbname=bancocjweb1', 'postgres', '1...
asked by 02.09.2014 / 07:01
1
answer

Mysqli bind with an array of values

I have a code in PDO and I need to convert this code to mysqli, at this moment I have something like that: $sql = "SELECT * from tabela where nome = ? AND idade = ? AND outro = ?"; $stmt = $core->conn->prepare($sql); $bindArray = array...
asked by 04.12.2015 / 12:56
3
answers

How to connect to MySQL only once, without ever having to instantiate?

How do I connect to MySQL only once, without having to re-write it in every function? Currently I do this: class Site { var $driver; var $host; var $dbname; var $user; var $pass; public function __construct($driver,...
asked by 08.12.2014 / 14:51
4
answers

Difference between prepare () and query ()?

I was doing select on a table. I went to see the result, returned false. Then I used query and it worked. What's the difference between the two? <?php $query = DB::getConn()->prepare('select * from tabela where id...
asked by 14.10.2015 / 22:37
1
answer

Dynamic Bind with prepare ()

I'm doing a function using the PDO, when I try to use the PREPARE method the function does not finish successfully, it replaces PREPARE with QUERY by changing some arguments and it worked. But my question is the following because what with PR...
asked by 23.09.2014 / 05:23
2
answers

Name of the months in Portuguese and English

In the site where I work, I use the following query to display in Portuguese the dates that are stored in the database: $conn->exec("SET lc_time_names = 'pt_PT'"); However, I discovered that the site will become bilingual (Portuguese a...
asked by 25.02.2014 / 17:34
2
answers

Problem with quotation marks when doing INSERT SQL

I'm doing a CRUD with PDO, but the prepare () method query only works with "double quotes" Ex (this works): "INSERT INTO '_user' ('firstname') VALUES ('blabla')" That's not how it works: "INSERT INTO '_user' ('firstname') VALUES ('blab...
asked by 15.09.2014 / 20:39
3
answers

INSERT Query does not work inside a loop

So folks, I'm not able to solve this problem of a query inside a foreach loop does not execute. First of all I thought it was something wrong with pdo-> beginTransaction so I commented this part and left pure code only. <?php if (is...
asked by 10.08.2014 / 01:31