E
E
Evgeny Ivanovich2018-05-05 12:14:43
MySQL
Evgeny Ivanovich, 2018-05-05 12:14:43

How to extract more than one row from MySQL database?

I send a query: "SELECT * FROM tbl WHERE something='12'", I get an object, I convert it to an array, but in this array there is only one row of data, although several rows match the query.

Answer the question

In order to leave comments, you need to log in

9 answer(s)
Y
Yan-s, 2018-05-05
@Yan-s

where is the code?

T
TCloud, 2018-05-05
@OTCloud

Write SELECT * FROM `TABLE`WHERE `Something` LIKE 12;
The query should return all rows where something is equal to 12. And read at the W3C how the Like construct is used in different DBMS.

T
ThunderCat, 2018-05-05
@ThunderCat

A guide to overcoming "nothing works" problems:
1) Break the task into steps (large first, then smaller if necessary)
in your case there is 1) a query that "should" (shouldn't) select multiple rows. We go to the console or phpmyadmin and write the request there directly. If the query returns 1 record, let's go learn SQL syntax.
2) If the problem is not in the request - there is a wardump for the result of the output from the function that works with the database, maybe you are using the wrong thing - let's go read about your database adapter and functions from it.
3) We get the object - how and what happens here - a mystery, check what you feed at the input, see where data is lost during the algorithm, what you get at the output.
Hint: var_dump(), print_r();

G
Gleb Nikolaev, 2018-05-05
@glebn

It looks like you are overwriting the elements of an array. Give the code in which you convert the object to an array, most likely there is an error in it

S
Sergey, 2014-05-26
@edinorog

pissed off =(

A
Andrey Plax, 2014-05-27
@Hereigo

pr0l - I meant that you can already determine the problem by the squeak - en.wikipedia.org/wiki/%D0%97%D0%B2%D1%83%D0%BA%D0%...

R
Rsa97, 2014-05-26
@Rsa97

>> other wires
Disconnect everything, connect one at a time, checking after each step.

E
Eugene Obrezkov, 2014-05-26
@ghaiklor

As @Rsa97 said, turn off pretty much everything. Pull out video cards, all sorts of modems, peripherals, hard ones - in short, almost everything. Even pull out the entire RAM, without it, first start it. And then connect one by one what he complains about.

D
Daniil Miroshnichenko, 2014-05-26
@miroshnik

If it does not even turn on, then most likely it is in the PSU. Try installing another PSU. If there is no other power supply at hand and there is no one to take it from, then drag your old one to any service and ask it to check for performance.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question