Questions tagged [fetchall]
165 questions
3
votes
1 answer
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error' in
I have this function and it keeps giving out the error "Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error' in..." The error is directing me to the line "$row = $q2->fetchAll(PDO::FETCH_OBJ);". I've searched…

Jamal
- 151
- 1
- 2
- 7
3
votes
1 answer
PHP, Using PDO with nested queries, results corrupted
I'm using PDO against MSSQL, and need to run nested queries. They are all prepared statements. If I try to use the fetch() method, it inner queries fail immediately, so I used fetchAll(). So, I get something like this, with Programs, Products and…

Mike Nicewarner
- 51
- 3
3
votes
3 answers
Out of memory error in php
I am on php 5.2.5 and executing a script from command line. In this script I am manipulating the data fetched from db. To fetch data from db I am using Zend Adapter.
I notice an increase in memory(262144 bytes) after invoking
…

Nidhi Kaushal
- 299
- 4
- 15
2
votes
1 answer
PHP: Displaying table data using fetchall()
Quick PHP/MySQL question:
I'm trying to display the data from a MySQL database table as an HTML table, and for some reason my code doubling the output of each piece of data.
This is my code:
$rowarray = $statement->fetchall();
print "\n"; …

Todd Bauer
- 219
- 1
- 7
- 15
2
votes
1 answer
Difference between cursor.fetchall() and pandas Dataframe
I know there are a few ways to retrieve data from RDB table.
One with pandas as read_sql, the other with cursore.fetchall().
What are the main differences between both ways in terms of:
memory usage - is df less reccomended?
performance - selecting…

Liorb
- 21
- 1
- 4
2
votes
2 answers
What is an optimum way to read huge data from oracle table and fetch into a data frame
I am going to read data from a table in my oracle database and fetch it in a data frame in python.
The table has 22 million records and using fetchall() takes a long time without any result.
(the query runs in oracle in 1 second)
I have tried using…

mahsa-ebrahimian
- 141
- 1
- 3
- 10
2
votes
1 answer
How to compare values from Array references in perl?
#!/usr/bin/perl -C0
use strict;
use warnings;
use DBI;
sub agg_verification
{
my ($list,$tblname,$values);
my $res1=undef;
my $res2=undef;
#First DB Connection******
my $connstr = "ENG=xxx;CommLinks=tcpip{port=xxx};UID=xxx;PWD=xxx";
…

Dipit Sethi
- 98
- 1
- 1
- 8
2
votes
1 answer
cakephp check conditons when there is no validation
How can I set up conditions to call mysql function from cakephp when there is no cakephp (from model) validation
code which call mysql function from controller :
$generateDocNum = $data_source->fetchAll("
select generateDocNum(?, ?, ?, ?, ?) as…

Kode Kite
- 328
- 5
- 15
2
votes
2 answers
Zendframework / PgSQL fetchAll orderby
i have a pgsql table with fields id, identifier, name.
id serial NOT NULL,
identifier character varying(16),
name character varying(128)
I want to fetchAll values from the table orderby identifier.
but identifier is having values
12, 100,…

viMaL
- 638
- 1
- 7
- 20
2
votes
0 answers
pymysql ipython notebook - error during SQL query resultset fetchall()
Given a MySQL database of Wordpress 4.0. I'm running the following query on the database:
conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='geheim', db='mysite')
cur = conn.cursor()
cur1 = conn.cursor()
cur.execute("select…

Krischu
- 1,024
- 2
- 15
- 35
2
votes
1 answer
SQLSTATE[HY000]: General error with MySQL variable in ZF1
I have a MySQL query that works perfectly in PhpMyAdmin but throws an SQLSTATE[HY000]: General error when using within Zend Framework 1.12 and its fetchAll() method. Here it is:
SET @csum := 0;
SELECT s1.Date, (@csum := @csum + s1.total) as…

D4V1D
- 5,805
- 3
- 30
- 65
2
votes
1 answer
Using array_shift on while loop with fetchAll() on SELECT * from mysql
I have a question on understanding how using *array_shift* with a fetchAll on a while loop in this example works? The intended result is just to fetch the data from the db and use it for filling out a CRUD app.
I understand *array_shift* drops off…

webdev
- 741
- 5
- 16
2
votes
2 answers
How to use both fetch() and fetchAll() in a PDO wrapper class?
How can I alter my PDO wrapper class, so that if I expect a single row result with my query it uses fetch() and if it expects multiple results it uses fetchAll().
Right now, if I have only one result I still have to loop through the result array and…

Stefan Schneider
- 157
- 3
- 18
2
votes
1 answer
How do I use fetchAll in php?
I am using this statement to fetch the elements in a column in my db
$result = $stmt->fetchAll(PDO::FETCH_COLUMN, 0);
but I get this error when trying to run it.
Call to undefined method mysqli_stmt::fetchAll();
Is there something I need to add to…

linuxer
- 523
- 2
- 4
- 22
2
votes
2 answers
How to do this lookup more elegantly in Python and MySQL?
I have a bunch of files in a directory named with nameid_cityid.txt, nameid and cityid being the ids of name (integer(10)) and city (integer(10)) in mydata table.
While the following solution works, I am doing type conversions since fetchall fetches…

ThinkCode
- 7,841
- 21
- 73
- 92