Questions tagged [fetchall]
165 questions
0
votes
1 answer
zf3 db - fetchall returning duplicated rows
I'm having a issue with zend-db, when I use fetchall(), the rows return duplicated, for example:
{
"title" : "Florianópolis",
"neighborhoods" : [ {
"0" : "6",
"1" :…

Thomas F. Feijoo
- 1
- 4
0
votes
1 answer
pdo code for fetching data dynamically in a table
I want a pdo code for fetching data from database into a table dynamically when the page is opened.It took me an entire day but I still didnt get an appropriate code,PLEASE HELP ME OUT
…

Pihu
- 7
- 3
0
votes
2 answers
retrieve data sqlite3 into list python
I want to retrieve data from sqlite3 table, this is my code, but I only get an empty list. I checked my query on the sqlite3 and it works fine there.
import sqlite3
conn = sqlite3.connect("testee.db")
c = conn.cursor()
myquery = ("SELECT stock FROM…

Payam Mesgari
- 953
- 1
- 19
- 38
0
votes
1 answer
PDO: Get all untested flashcards from database
I am trying to get all flashcards from a specific deck (deck_id) that are pending.
A flashcard is pending when
it hasn't been tested,
next_review is not set (new card) or
next_review <= $today (means card is due to review).
What I currently…

Kamesan
- 3
- 2
0
votes
3 answers
how handle a variable if it's returning none
Hi I have the following function to get sql from my template. variable row is fetching the query which is input by the user. If the user input an invalid sql am getting an error as UnboundLocalError: local variable 'row' referenced before assignment…

vellattukudy
- 789
- 2
- 11
- 25
0
votes
1 answer
presto fetch data
I have a result like this from presto command:
a| b| c
--+--+------
1 | 3| 6
2 | 4| 5
I know of cursor.fetchall() for all the data and cursor.fetchone() for a single row.
Now, I would like to get all the data from a particular column e.g.…

Ezekiel
- 167
- 3
- 11
0
votes
1 answer
Save SQL data to PHP array
I want to pull the data from a SQL table to an array in my PHP script. I need that because after that I want to compare two tables.
$sql = "select date, sum(clicks) from Table group by date";
$query = $Db->query($sql);
$result = array(); //…

Datacrawler
- 2,780
- 8
- 46
- 100
0
votes
2 answers
Mysqli Retrieve data and display them - best way
Which one of the options below is better
Option 1:
//control file:
$smpt = $con->query("SELECT id,name FROM customers");
//fetch all resuts
$results = array();
while ($row = $result->fetch_assoc()) {
$results[] = $row;
} …

user3383008
- 43
- 5
0
votes
2 answers
Get fetchall result from different class
let me explain what i'm trying to do.
In one DBcommand.php file i have :
class DBcommand Extends PdoDB {
public function selectAll() {
$stmt = $this->dbh->prepare("SELECT hwid,username,pcname FROM users");
$stmt->execute();
…

snow
- 162
- 1
- 13
0
votes
1 answer
PHP DBH->fetch() and fetchAll(), there is a way to get rid of "numbered" items in the returned arrays?
I copy and paste the example from one PHP docs page, 'cause the case is similar: when I execute a MySQL query using DBH->fetch() I obtain an array:
prepare("SELECT name, colour FROM fruit");
$sth->execute();
/* Fetch all of the…

simonelippolis
- 133
- 10
0
votes
1 answer
PDO fetchAll Results returns only one record issue
I have developed the following script in my localhost (using wamp 2.2, apache 2.2.1 windows, php 5.3.9, mysql 5.5.20). When I upload the script to the production server (apache 2.2.29 unix, php 5.3.29, mysql 5.5.42)
I noticed that the php+pdo…

vicmontol
- 139
- 6
0
votes
1 answer
Pythons fetchall eats all my swap memory
I'm executing a query on a table where I get a column with some hundred million rows back, this is because I want to plot them in a histogram. The problem is that this eats up nearly all my memory (7.8 gb) and all my swap memory (8gb) before the…

bjornasm
- 2,211
- 7
- 37
- 62
0
votes
3 answers
pymysql connection select query and fetchall return tuple that has byte literals like b'25.00' rather than strings like '25.00'
I have a python script that runs fine when only connecting to my local test machine having MySQL 5.6database on Windows 8.1, using pymysql connection.
Select query / fetchal() returns tuples like ('1', '2015-01-02 23:11:19', '25.00').
However, when…

Michael D.
- 5
- 1
- 3
0
votes
1 answer
Can't fetch any data with PDO's fetch or fetchAll function
I've been at this for some time. Using PDO's documentation and based on older stackoverflow posts I feel I am doing this correct, however I can not figure out where my data is in the array returned by fetchAll. Any help would be appreciated.
In my…

seanr
- 195
- 1
- 4
- 10
0
votes
1 answer
Fetch row issue in zend
I am using following code for fetch records. My code is working fine but it returns a array not a object. Any guess why this happening..
$select = $this->_db->select()
$select->from('users',array('id'));
if($where != '')
{
…

vijay2991
- 131
- 2
- 4
- 13