Questions tagged as 'pdo'

2
answers

How to sum a column of a database using PDO

Good evening, everyone. I have little programming experience. I apologize if I am not very clear on the question. I have a MySQL database (phpmyadmin) with a table named "my_table" having one of the fields named "value". I need to add the "va...
asked by 15.11.2016 / 02:06
1
answer

while in infinite loop using $ result = $ result-fetch (PDO :: FETCH_ASSOC);

<?php include ('pdo.php'); class crud { public static function select($arg){ $pdo = new pdoinit(); $result = $pdo->prepare($arg); $result->execute(); $resultado = $result->fetch(PDO::FETCH_ASSOC);...
asked by 14.11.2016 / 16:01
1
answer

UPDATE with different conditions in the same query

How to update multiple records by setting different values, eg: $update = "UPDATE tabela SET ativo=1, nivel=2 WHERE nome ='jose' AND nome='maria' AND n...
asked by 18.04.2016 / 21:26
1
answer

Select with Search Terms

I need to make an query where I only display results in one condition: # Search the Database $select_sql = "SELECT * FROM users WHERE user LIKE :search OR date_access LIKE :search OR ip LIKE :search AND active LIKE :active ORDER BY id DESC"; $...
asked by 14.09.2016 / 21:49
2
answers

INSERT duplicate with mysql :: PDO

Can anyone explain why when I run this code it INSERT twice the same value in the table? I believe that this problem happens when I do a validation to verify that the values have been entered: if(!$lc_follow_dados->execute())...
asked by 10.02.2016 / 15:34
1
answer

select with pdo in functions

How do I use my select that is in my funções.php in this table that is in my estoque.php , I already did the script I just can not call the $resultado that is in the function to use in foreach . STOCK.PHP         ...
asked by 23.12.2015 / 03:18
2
answers

Search without returning PDO data

My variable is being passed but in the filter process it is not always returning anything. try { $keyword = trim($_GET["keyword"]); if (!empty($keyword)) { $sql = "SELECT * FROM noticias WHERE titulo LIKE :keyword...
asked by 07.10.2015 / 22:14
2
answers

Problem with INSERT using PDO

I have this code below that is working perfectly, but I would like to change it to work in PDO but I am having trouble registering with DB when I change it to the PDO. It refers to errors online143 and line 164 ThecodeinMysqlthatiswo...
asked by 28.05.2015 / 21:50
1
answer

PDO - Class Not Found

What's happening I created a static method to return the connection so that I can use it in DAO, but doing so gives Class Not Found PDO . OtherProjectsThefirstthingthatmanypeoplewillthinkis,"The extension is not activated." Sirs, the extensi...
asked by 29.05.2015 / 17:13
1
answer

DBLIB PDO AND UTF-8 CODING

I'm in a project using 64bit UBUNTU-SERVER as WEBSERVER. In the project I chose the database Microsoft Sql Server 2012 which I have a use license acquired shortly. With much effort I got the connection using some libs like sybase freetds ......
asked by 24.02.2016 / 18:21