Title: echo returns &quot;Array&quot;
Last modified: August 21, 2016

---

# echo returns "Array"

 *  [cuk](https://wordpress.org/support/users/cuk/)
 * (@cuk)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/echo-returns-array/)
 * I’ve created a table (rjecnik) in the wordpress database and I’m trying to retrieve
   data from it with:
 * <?php
    $izraz=$wpdb->get_results(“SELECT ‘engleski’ FROM ‘rjecnik’ WHERE ‘id’
   =2”); echo $izraz ?>
 * It’s returning – Array. Why?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [12 years, 10 months ago](https://wordpress.org/support/topic/echo-returns-array/#post-3924172)
 * Because the get_results function returns an array
 *  Thread Starter [cuk](https://wordpress.org/support/users/cuk/)
 * (@cuk)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/echo-returns-array/#post-3924208)
 * Thanks, but I bumped into another problem. The previous piece of code was written
   in a page template together with an HTML form. I didn’t know which URL to put
   into the action attribute, so I made a new PHP file called database_list.php (
   in the child theme folder):
 *     ```
       <?php
       	if (isset ($_GET['upis'])&&!empty($_GET['upis'])){
       	$upis=$_GET['upis'];
         	$mocnesi=$wpdb->get_var("SELECT engleski, prijevod FROM rjecnik WHERE id = $upis");
       	echo $mocnesi;
         	}
       ?>
       ```
   
 * And I moved the form code into the main page:
 *     ```
       <form action="database_list.php" method="get">
         Upisite rijec!
         Trazena rijec: <input type="number" name="upis">
         <input type="submit" value="Trazi">
       </form>
       ```
   
 * I don’t know how to return the $mocnesi value found by the query to html to display.
   Any help?
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [12 years, 10 months ago](https://wordpress.org/support/topic/echo-returns-array/#post-3924252)
 * Have you tried looping through it using a “foreach” PHP loop?
    _[http://php.net/manual/en/control-structures.foreach.php](http://php.net/manual/en/control-structures.foreach.php)_
 *  Thread Starter [cuk](https://wordpress.org/support/users/cuk/)
 * (@cuk)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/echo-returns-array/#post-3924288)
 * I had problems with picking the right array type. Works with associative. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘echo returns "Array"’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 4 replies
 * 2 participants
 * Last reply from: [cuk](https://wordpress.org/support/users/cuk/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/echo-returns-array/#post-3924288)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
