How do I get only one result from a query without having to do a loop
<p>How do I get back only one row in my query search using mysqli_</p>

<p>I've been reading about here:<br>
<a href="https://cameronspear.com/blog/get-a-single-value-from-mysql-database-in-one-line-of-php/" rel="nofollow">Here</a></p>

<p>where it says that I can do a query like this:  </p>

<pre><code>$name = $mysqli-&gt;query("SELECT name FROM contacts WHERE id = 5")-&gt;fetch_object()-&gt;name;
</code></pre>

<p>but it does not work for me.</p>

<p>this is what I have:</p>

<p>$connection= mysqli_connect("localhost", "root", "", "my_db");</p>

<p>using the same principle as the one in the page: </p>

<pre><code>echo $result = $connection-&gt;query("SELECT organization FROM organizations_table WHERE status !=0 AND token=".$TOKEN)-&gt;fetch_object()-&gt;organization;
</code></pre>

<p>I suppose <code>fetch_object()-&gt;organization;</code> is the name of my table field.  </p>

<p>Or is there a better way to do this, not that this way is working for me.
I'm using procedural php with mysqli_</p>