Questions tagged [fetchall]
165 questions
0
votes
2 answers
How to Fetch All for Pdo Search
I am new to PHP, my PDO search seems to fetch single row from my database though it has five row data with the same date. How do i fetch all of the data that has the same date using PDO?
Below is my code.
if(isset($_POST['Find']))
{
//…

Stella
- 1
0
votes
1 answer
What is the correct syntax when using foreach and mysqli_fetch_all
As part of another problem I need to use mysqli_fetch_all (which I am told creates an array). I have never used it before and can not find solutions on the Internet that I can understand. I am trying to get this to list the keys and values of the…

Garry Jones
- 45
- 2
- 8
0
votes
1 answer
fetchAll() - Is really necessary?
Example 1°:
$stmt = 'SELECT * FROM table ORDER BY id DESC LIMIT 2';
$Dp = $conn->query($stmt)->fetchAll();
Example 2°:
$stmt = 'SELECT * FROM table ORDER BY id DESC LIMIT 2';
$Dp = $conn->query($stmt);
What's the difference between both examples?…

Susi
- 153
- 1
- 3
- 11
0
votes
2 answers
Combine multiple array but when one array is empty not show anything in php
I need help about combine multiple array from database and fetch with
fetchAll(PDO::FETCH_ASSOC)
first I look for data member with percentage of 90% and every data in search in database in subtract one column in query "SELECT", for example like…

Ivan Juliant
- 97
- 1
- 14
0
votes
2 answers
Python fetchall return true and false
I have a python script that makes a fetchall():
connection = pymssql.connect(host='host', user='user', password='pw', database='database', as_dict=True)
cursor = connection.cursor()
cursor.execute("EXEC SPname")
data=cursor.fetchall()
My problem…

tg_dev3
- 171
- 3
- 18
0
votes
0 answers
PHP/PDO taking select taking longer than CLI or MySQL Workbench
I have a windows production server running IIS7 and PHP 7.2 connecting to a Linux db server.
When I make the query "select * from posts" on the production server from the CLI or inside MySQL Workbench it returns all results in an average of 0.25…

MetalStryker
- 13
- 4
0
votes
0 answers
Retrieving data from SQL server with pymssql in python is replacing 0 with False and NULL with None
Following code is replacing 0 integer with False and Null with None:-
with open(tablename, "r") as table:
tname = table.read().splitlines()
sqlConnection = pymssql.connect(host_LZ,username_LZ,password_LZ,src_database)
cursor =…

VKul
- 1
- 1
0
votes
1 answer
In rxjs, I try to fetch all the data first then I need to proceed to next line
In Angular 5, I have observable array in service and I am subscribing this in component. And in the next line of statement I am checking whether the data was populated or not. But I found variable is not populated…

singapore saravanan
- 83
- 2
- 11
0
votes
1 answer
PHP fetchAll(PDO::FETCH_ASSOC) returns null in statement
I am trying to fetch data inserted in my database using PDO::FETCH_ASSOC.
for some reason (probably lack of understanding...) I cant echo the data from the class method.
This is the db table structure:
I want to execute the data as an associative…

DavSev
- 1,005
- 4
- 22
- 47
0
votes
1 answer
fetchall error in PDO
I'm trying to write code to insert new items into a database.
if(isset($_POST['btnAddVeg'])){
$addVegType = $_POST['txtAddVegType'];
$AddVegName = $_POST['txtAddVegName'];
$insertQuery = 'insert into vegetables (vegetable_type, vegetable_id) …

dawie
- 3
- 3
0
votes
1 answer
PyMySQL - getting column data from dictionary by fetchall in
Using PyMySQL python 3.6.3 versions, getting an DictCursor, and then fetchall(). I get all the data and .description says:
(('recdate', 12, None, 19, 19, 0, False), ('outdoorhumidity', 246, None, 9, 9, 3, True), ('outdoortemperature', 246, None, 9,…

OldBadger
- 1
- 4
0
votes
1 answer
Create non-repeat username data base
I wrote def addmember to add member to database.db. I want no repeat in user name, example: when i add member (1,1) to database, i cannot add member (1,2) to my database because already have user with username "1". But my code still allow it ! Can…

dauhuong68
- 19
- 1
- 7
0
votes
1 answer
Executing multi-table queries with Python MySQLdb
I have been trying to return the values from two different tables, but can't seem to get the c.execute(query) function to return what I want it to. Currently my code will return the first c.fetchone()[0], but the second fetchone()[5] gives an error…

douglasrcjames_old
- 87
- 13
0
votes
1 answer
PHP/SQL - Query to Array Load Time
for a little while now I've had this problem that causes my PHP to take upwards of 20 seconds to load (even on the host machine containing the Apache + SQL Server).
Google Chrome Network Report
I've done a bit of digging around and it seems like…

kpjVideo
- 413
- 2
- 6
- 21
0
votes
1 answer
cursor.fetchall() returns empty tuple with cx_Oracle
I created a table with 4 records. The table description is like:
Employer
Now when I run the following piece of code:
import cx_Oracle
con = cx_Oracle.connect("system/******@localhost/xe")
cur = con.cursor()
cur.execute("SELECT * FROM…

AliZaidi
- 27
- 1
- 10