Questions tagged [fetchall]
165 questions
1
vote
1 answer
python sqlite fetchall not returning correct data type
I am having an issue with having fetchall return being the correct data type. fetchone does work?!?!
con = sqlite3.connect('test.db', detect_types=sqlite3.PARSE_DECLTYPES)
with con:
cur = con.cursor()
cur.execute("SELECT df1 FROM…

zippo
- 43
- 2
- 8
1
vote
1 answer
Apache crashing while using Zend Framework
I have recently been studying the Zend Framework, but I have ran into a problem.
Apache crashes when I run :
$this->db->fetchAll("SELECT COUNT(DISTINCT userid) AS NumberOfUsers, COUNT(id) AS total FROM notebook")
But,this don't happen if I…

lili
- 37
- 3
1
vote
2 answers
Handling fetchAll from huge mysql query without memoy limit error
I am trying to fetch huge amount of data from one mysql table to be exported as XLSX file.
I used fetchAll() function, but I got
Fatal error: Out of memory
Here's my code:

CairoCoder
- 3,091
- 11
- 46
- 68
1
vote
1 answer
PDO fetch and fetchAll with conditional statement not working
his is not working can anyone help please?
(count($stmt->fetchAll()) > 1) ? $result = $stmt->fetchAll() : $result = $stmt->fetch();
print_r($result);

Abdul Moiz
- 1,317
- 2
- 17
- 40
1
vote
1 answer
python MySQL Fetchone / Fetchall update
I have tried everything for the past 48 hours and have not figured out where I am going wrong.
The cursor.fetchone() works as shown:
row = cursor.fetchone()
for i in row:
x = '13.5m'
cursor.execute("""UPDATE table SET market_cap =%s…

grove park
- 86
- 1
- 1
- 9
1
vote
1 answer
Show query Zend Framework
I want to show all queries on table , I've tried two type of connection, but I want to know best idea
$AModel = new Model_A();
$select = $AModel->fetchAll($AModel->select()->where('user_id like ?', '%9893%' ));
$rowArray =…

Farzan Najipour
- 2,442
- 7
- 42
- 81
1
vote
1 answer
$GLOBAL Setting a table in array Call to member function
Okay, I'm using GLOBALS to set some settings within my whole site
$tmp = $GLOBALS['_ODB']->query("SELECT * FROM `options`");
$GLOBALS['options'] = NameToTop($tmp->fetchAll(PDO::FETCH_ASSOC));
I have this as my query, then I use this function to put…

Ryan
- 25
- 5
1
vote
1 answer
Importing mysql table in excel
I am noob in python but I need to export MySQL table into .xls file using xlwt in python. I succeeded in exporting the table using example from…

123Kool
- 11
- 2
1
vote
2 answers
Checking result/count before outputting while loop
I'm looking for a way to SELECT from database, then check the result, and then output rows in a while loop (IF the result was above zero)
I really want to avoid using a separate count query
Right now I use this:
$sql = 'SELECT id, username,…

mowgli
- 2,796
- 3
- 31
- 68
1
vote
2 answers
Returning an array with PDO - using FetchAll doesn't work
I use the following code to retrieve data from my database. The problem is that it only displays the first row. In this particular case, it means that only the first picture is shown on the webpage but I want to show all of them.

Stan
- 937
- 5
- 15
- 33
1
vote
2 answers
PHP function for changing values in array from database
I have array with values from database
$values = $sql->fetchAll();
Which looks like this:
var_dump($values);
array (size=4)
0 =>
array (size=4)
'id' => string '1' (length=1)
0 => string '1' (length=1)
'level' => string '0'…

Petr Hurtak
- 2,239
- 1
- 19
- 18
1
vote
1 answer
zipping rows with columns in SQLalchemy?
I am converting my library from using pyodbc to SQLalchemy. Unfortunately I am getting this error:
TypeError("unhashable type: 'list'",)
Here is my function:
@route('/api/query/') # not a public system!
def qry(query):
# `conn` is…

stackoverflowuser95
- 1,992
- 3
- 20
- 30
1
vote
0 answers
"fetchAll" command doesn't work ( Zend Framework ) with long sql query statment
I'm trying to send throught "fetchAll" command of zend framework (PHP) a query to mysql DB. the query is composed by a large amount of characters (about 9000 characters).
My query is like: select * from mytable where name_text like 'bla bla…

joppo
- 11
- 1
1
vote
3 answers
Downloading arrays off cur.fetchall() in Python and Oracle 11g
I'm trying to download a single array off of Oracle 11g into Python using the cur.fetchall command. I'm using the following syntax:
con = cx_Oracle.connect('xxx')
print con.version
cur = con.cursor()
cur.execute("select zc.latitude from orders…

Bryan
- 5,999
- 9
- 29
- 50
1
vote
2 answers
PHP pagination fetchAll() and LIMIT
This code work well on first page, but seems that LIMIT don't affect FetchAll().
So my question is:
Do fetchAll() have some optional argument that limit number of rows?
Or suggest my a better way to solve this…

overdose
- 41
- 1
- 1
- 5