Questions tagged as 'pdo'

1
answer

Return an PDO query in an array

How do I make a query with PDO and return the results in a array . Ex: I need to make a query that returns 10 rows, each row has 3 columns <?php $equipe1 = $_POST['equipe1'];//Pega o Nome da equipe $equipe2 = $_POST ['equip...
asked by 21.01.2017 / 01:23
1
answer

Run PHP without refreshing the entire page

My code is this: <?php $buscarusuario=$pdo->prepare("SELECT * FROM top5 WHERE status = 'ativo' ORDER BY colocacao ASC"); $buscarusuario->execute(); // Exibir com Fetch_Obj $linha=$buscarusuario->fetchAll(PDO::FETCH_OBJ); foreach (...
asked by 02.08.2016 / 19:43
1
answer

mySQL result coming with the bars

I'm using link , and when I send something to the database, for example, if I add this HTML tag <img = src="http://link">intheeditor,andsendittothedatabase,itsaves<img==\"\" src=\"http://link\"> and that way when I select it...
asked by 20.01.2016 / 23:03
2
answers

Return the data difference of two sql tables

I have a ESCOLA table with ID_ESCOLA and NOME_ESCOLA and another table PROFESSORES that contains a FK_ID_ESCOLA and NOME_PROFESSOR . I wanted a table that would give me the name of all the schools, but th...
asked by 26.06.2015 / 20:06
1
answer

Insert with pdo and OO

I have the following class that manages bank: <?php abstract class database{ /*Método construtor do banco de dados*/ private function __construct(){} /*Evita que a classe seja clonada*/ private function __clone(){} /*M...
asked by 09.11.2015 / 00:44
2
answers

Why does not Update?

Whydonotyouupdate?...Noerrornonesodonotupdate//Prepraligacaophpmysql$stm=$pdo->prepare('SELECT*FROMsol_camisetaWHEREcod_nome_aluno=:id');//Atribuioparamentroao$_GET['id']queéoidqueestanaurlecolocaelenoprepareacima$stm->bindValue(':id',$_...
asked by 13.10.2015 / 01:40
2
answers

SQL Parameter in PDO PHP does not work

The following code returns 11 bank records: $dbh = new PDO('sqlite:db_coleta.sqlite3'); $sth = $dbh->prepare('SELECT * FROM ROTA_VIEW WHERE usuario_id = 1 AND 0 = 0'); $sth->execute(); $red = $sth->fetchAll(); var_dump($red); But...
asked by 07.08.2018 / 14:42
2
answers

Using links with PDO in PHP

I'm trying to create a PDO loop where I can choose the desired field to position it on the page. But the code I'm using is bringing all the fields in one go. My code looks like this: include("libraries/conn.php"); $sql = "SELECT content...
asked by 19.07.2018 / 16:29
1
answer

How to pass table field name mysql as parameter via PDO PARAM?

I have a form where the user defines some criteria for the system to search the data in a mysql database. Among the criteria, the user can choose two search options. These options are two fields of the table in that database. The data is sent...
asked by 14.11.2018 / 02:44
1
answer

Search in multiple tables

Hello, I'm trying to search in 3 different tables, see my code: $buscando = $pdo->query("SELECT * FROM filmes WHERE nome LIKE '%$busca%' AND status='ativo' ORDER BY nome ASC"); The tables would be: animes, films and series. All have the...
asked by 19.08.2017 / 00:25