Questions tagged as 'pdo'

1
answer

How to update a different table with a data from another table in PDO

Personal I have a payroll table, and I have an indemnification code for each transaction, when receiving the data of the update, I want to get the data and insert in update in another table of the bank being that 1 of the fields does not have in...
asked by 26.06.2017 / 20:46
1
answer

What is the best way to repeat the same query without copying and pasting?

I have a query and I need to use it twice, one I'm going to use fetchCollum and another I'm going to use fetch(PDO::FETCH_ASSOC) . That said, I can not apply a fetch and then apply another fetch , for example: $tokenH...
asked by 13.06.2017 / 17:26
2
answers

Translate mysql_query to PDO "UPDATE * SET ... WHERE ..."

Hello, I recently started translating my sites to PDO for obvious reasons. However this is giving me a bit of a headache. $sql = mysql_connect("localhost", "user", "pass") or die(mysql_error()); mysql_select_db("banco") or die(mysql_error());...
asked by 14.06.2017 / 15:21
1
answer

Know result of count () in query

I have the following query in pdo: $ranking = $pdo->query("SELECT * FROM usuarios GROUP BY moedas ORDER BY count(moedas) DESC LIMIT 3"); I use this to make a ranking to know users with more coins. However, I am using a second query with...
asked by 29.06.2017 / 05:59
1
answer

Draw system

I'm intending to make a sweepstakes system on my site. I read some questions (including one that I really liked what was this one ) and I noticed people saying that X Cities could never be raffled, while Y Towns raffled several times. The qu...
asked by 20.05.2017 / 18:59
2
answers

Join a bunch of selects in one

I have 4 selects to do that I then put in the separate combobox only I want to put everything together in a single has? $sqlq = $pdo->prepare("SELECT * FROM tbl_tipo ORDER BY tipo ASC"); $sqlq ->execute(); $sqlqu = $pdo->prepare("SELE...
asked by 10.05.2017 / 15:57
1
answer

Duplicate data in the response of a query

Here is the code:      $conn = new PDO('mysql:host=localhost;dbname=locadora','root',''); $resul = $conn->query("SELECT * FROM usuario"); echo "<pre>"; $resul = $resul->fetchAll(); ?> And the output looks like this: arr...
asked by 11.06.2017 / 04:14
1
answer

rowCount does not return zero

I have this script: <?php include 'config.php'; if(isset($_POST)){ $user = isset($_POST['user']) ? strip_tags($_POST['user']) : 'HabboColorFS'; $rank = $pdo->query("SELECT * FROM topicos_comentarios WHERE autor='".$user."'")->rowCount...
asked by 27.05.2017 / 03:06
1
answer

PHP PDO - MySQL query data does not appear in the table

What am I doing wrong in this script? I make a query in the database to return all the data from the curso table and display their names in the table, but it is not working. In addition this part of the code is being displayed on th...
asked by 22.04.2017 / 06:19
1
answer

After registering (in PDO), direct the page to index.html

I'm using HTML and PHP. The connection to the bank works, it registers the entered data and everything. Next, I open index.html, it has the option that takes me to the registration page: <li><a href="http://localhost/middleearth/form-...
asked by 25.03.2017 / 06:35