How to retrieve from MySQL database more than one line?

0 like 0 dislike
15 views
I'm sending this query: "SELECT * FROM tbl WHERE something='12'" get object, convert into array, but this array only the data from one row, even though the query returned multiple rows.
by | 15 views

4 Answers

0 like 0 dislike
where is the code?
by
0 like 0 dislike
Write SELECT * FROM `TABLE'WHERE `Something` LIKE 12;
The query must return all rows where something is equal to 12. And read W3C on how to use the design Like in different DBMS.
by
0 like 0 dislike
Allowance to overcome the problems of "nothing works":
1) Break the task into steps(first large, then smaller if you want)
in your case it is 1) a query that "should"(no) to select multiple rows. Go to the console or to phpMyAdmin and it prescribes the query directly. If the query returns 1 record - come learn the SQL syntax.
2) If the problem is not in the query - there is Vardan to output from a function that works with the database, you may not be using what is necessary, go to read about your database adapter and functions of it.
3) the object is - how and what happens here is a mystery, check that you feed input, see where the lost data in the course of the algorithm to get the output.
Hint: var_dump(), print_r();
by
0 like 0 dislike
It looks like you overwrite the array elements. Give the code where you transform the object into an array most likely it an error
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
0 like 0 dislike
2 answers
asked Apr 9, 2019 by Grigori_Psiholog
110,608 questions
257,186 answers
0 comments
33,707 users