Questions tagged as 'pdo'

1
answer

PDO PHP: How to make a logged in user delete your account?

User accesses the logged in page: <?php session_start(); echo 'Bem vindo, '.$_SESSION['username']; ?> <br /><a href='logout.php'>Logout</a> I want him to push a button or link and delete his own account (without typi...
asked by 21.08.2016 / 22:05
1
answer

Return 2 PDO queries in JSON

I need to return two queries. $id = $_POST['id']; $id = end(explode('editarnovoservico', $id)); $searchid = $pdo->query('SELECT * FROM cad_servicos WHERE id = '.$id); $searchid = $searchid->fetchAll(PDO::FETCH_ASSOC); $searchtiposervico...
asked by 30.07.2016 / 02:09
1
answer

Error executing trigger mysql

Good afternoon warriors, I'm having a problem implementing a trigger in mysql. It happens that I created a table called auditing with the same structure as the main attendance table, this audit table records all events, actions that are done in...
asked by 29.07.2016 / 19:33
0
answers

Difficulty with Weekly Agenda View

I'm trying to create a weekly display schedule that displays the scheduled classes for each day and time, and also leaves vacant schedules unchecked. I developed the following code to record all the dates of classes. However, I can not display s...
asked by 02.06.2016 / 01:32
1
answer

How do I make a logical condition comparing lines of a text file, using fopen in php?

I have the code below where it opens the file material1.txt , reads to the end and I need to do a comparison of one line with another for example: $material = fopen("c:/inetpub/wwwroot/material1.txt","r"); while(!feof($material)){...
asked by 26.04.2016 / 17:50
1
answer

Transaction history, how is it implemented?

I need to make a history of the last purchase (s) of the user (these infos will be shown in table ). Could you give me tips on how this history is usually saved? (need not do for me) Normally a column is created and within it an arra...
asked by 20.01.2016 / 18:01
2
answers

I have doubts if this would be the correct way to make a connection using the class PDO

I'm wondering if this form is actually correct to make a connection between php and mysql with the class PDO. The question is this: Every time I have a file that uses this connection it will create a new connection Class PDOUtil { public stat...
asked by 08.12.2014 / 23:36
0
answers

Connection database sql server 2008 PDO [closed]

I'm using the following code: try { $con = new PDO("sqlsrv:Server=ip;Database=nome","nome","12345"); $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { die ("Erro na conexao com o banco de dados...
asked by 28.12.2015 / 13:55
3
answers

Problem With PDO

My problem is the following when I execute this code below echo returns me 3 values Repeated I could not find out why you could give me a force? : D <?php try{ $sql = $pdo->prepare("select * from produtos"); $sql->...
asked by 04.12.2015 / 10:47
0
answers

Creating multidimensional array from query to BD MySQL

I have the following problem: I have a table in a MySQL database and in a code snippet I need to make content retrieved by a query made to this database be stored in a multidimensional array / array in php. The values of the two columns queri...
asked by 13.11.2015 / 15:25