fetchall

[zend][db] fetchAll with multiple variables

岁酱吖の 提交于 2020-01-13 10:04:49
问题 I'm trying to use fetchAll on a query that has 2 variables. I can't figure out the syntax. I can manage with only 1 variable: $sql = "SELECT * FROM mytable WHERE field1 = ?"; $this->_db->fetchAll($sql,$value1); # that works However I'm having some issues when query has multiple variables $sql = "SELECT * FROM mytable WHERE field1 = ? AND field2 = ?"; $this->_db->fetchAll($sql,$value1,$value2); # doesn't work $this->_db->fetchAll($sql,array("field1"=>$value1,"field2"=>$value2)); # doesn't work

Fatal error: Call to undefined method mysqli_result::fetch_all()

大兔子大兔子 提交于 2019-12-28 03:04:50
问题 I have problems with PHP in Ubuntu 10.04. When I try use mysqli_result::fetch_all this error appears: Call to undefined method mysqli_result::fetch_all() However, it works in Windows XP. The Code: $result = $this->dbh->query('SELECT [...] '); return $result->fetch_all(MYSQLI_ASSOC); I don't want to use fetch_assoc with a loop because I send the result to another layer for processing. I'm using PHP 5.4.4. and with php -m | grep mysql the mysqlnd module it doesn't appear. How can I install it?

PHP: Displaying table data using fetchall()

爷,独闯天下 提交于 2019-12-22 14:14:09
问题 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 "<tr>\n"; foreach ($rowarray as $row) { foreach ($row as $col) { print "\t<td>$col</td>\n"; } print "</tr>\n"; } My results look something similar to this: User ID | User Name | First Name | Last Name 1 1 User Name User Name First Name First Name Last Name Last

Is it normal that sqlite.fetchall() is so slow?

荒凉一梦 提交于 2019-12-18 05:18:06
问题 I have an sql query that selects from two inner joined tables. The execution of the select statement takes about 50 seconds. However, the fetchall() takes 788 seconds and it only fetches 981 results. This is the query and fetchall code: time0 = time.time() self.cursor.execute("SELECT spectrum_id, feature_table_id "+ "FROM spectrum AS s "+ "INNER JOIN feature AS f "+ "ON f.msrun_msrun_id = s.msrun_msrun_id "+ "INNER JOIN (SELECT feature_feature_table_id, min(rt) AS rtMin, max(rt) AS rtMax, min

PDO: Using fetchAll, still receiving General error: 2014

久未见 提交于 2019-12-13 08:58:40
问题 This problem is proceeding to drive me crazy... First a disclaimer, I have very little formal programming training. I am stumbling thru this. I am receiving the General error: 2014 error; at first it was one particular query (which was established in a class) and the warning was dependent upon where in the code I was instantiating the object. I proceeded to change every query to a fetchAll and then closed the cursor for every query as well after the fetchAll didn't work. Now there are two

Perl dbi (select) fetches empy strings in array

我只是一个虾纸丫 提交于 2019-12-11 04:19:18
问题 I have a perl script that connect to a postgres db and fetches a couple select statements that it runs on it. This output have the purpose to print in word afterword. While i was building my project i didn't notice something that happens with the fetching part ,it was after i print it in word that i noticed something strange. I execute a select statement and fetches this in an arrayref , but when i print this arrayreferentie I don't got only values in my array but also empty strings and de

pymysql connection select query and fetchall return tuple that has byte literals like b'25.00' rather than strings like '25.00'

怎甘沉沦 提交于 2019-12-08 10:15:40
问题 I have a python script that runs fine when only connecting to my local test machine having MySQL 5.6 database on Windows 8.1 , using pymysql connection. Select query / fetchal() returns tuples like ('1', '2015-01-02 23:11:19', '25.00'). However, when I use the same script slightly modified to include a second connection to a remote MySQL 5.0.96 production database running on a Linux server, it returns tuples like (b'1', b'2015-01-02 23:11:19', b'25.00') and the script does not run correctly

PHP: Displaying table data using fetchall()

佐手、 提交于 2019-12-06 09:17:09
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 "<tr>\n"; foreach ($rowarray as $row) { foreach ($row as $col) { print "\t<td>$col</td>\n"; } print "</tr>\n"; } My results look something similar to this: User ID | User Name | First Name | Last Name 1 1 User Name User Name First Name First Name Last Name Last Name Etc etc. You get the idea. Why this is happening? By the way, if I manually add the column

[zend][db] fetchAll with multiple variables

冷暖自知 提交于 2019-12-05 10:27:10
I'm trying to use fetchAll on a query that has 2 variables. I can't figure out the syntax. I can manage with only 1 variable: $sql = "SELECT * FROM mytable WHERE field1 = ?"; $this->_db->fetchAll($sql,$value1); # that works However I'm having some issues when query has multiple variables $sql = "SELECT * FROM mytable WHERE field1 = ? AND field2 = ?"; $this->_db->fetchAll($sql,$value1,$value2); # doesn't work $this->_db->fetchAll($sql,array("field1"=>$value1,"field2"=>$value2)); # doesn't work either The reason why I want to use ? instead of placing the variables directly into the query is that

Why is the same SQLite query being 30 times slower when fetching only twice as many results?

ぐ巨炮叔叔 提交于 2019-12-03 05:33:43
问题 I have been working on speeding up a query I'm using for about a week now and asked several questions about it here ( How can I speed up fetching the results after running an sqlite query?, Is it normal that sqlite.fetchall() is so slow?, How to use min() and max() in an efficient way?). With the very useful help from the answers given there I managed to get the time down to the sqlite query taking 100.95 seconds and fetchall taking: 1485.43 . This was still not enough, so after trying out