Object of class wpdb could not be converted to string
<p>I'm trying to get an organisation's ID by giving its name.
I have the following code:</p>

<pre><code>$orgid= $wpdb-&gt;get_var("SELECT organisationid FROM $wpdb-&gt;$table_name1 WHERE organisationname=' " . $organisation . "'");
</code></pre>

<p>This line returns this error:
Catchable fatal error:</p>

<pre><code>Object of class wpdb could not be converted to string
</code></pre>

<p>I wish to echo this ID onto the page.</p>

<p>I have read the codex but do not understand. How can I fix this?</p>