supplied argument is not a valid MySQL result
<p>I have written a function: </p>

<pre><code>function selectWithPaging($where){

 $pg = (int) (!isset($_GET["pg"]) ? 1 : $_GET["pg"]);
 $pg = ($pg == 0 ? 1 : $pg);
 $perpage = 10;//limit in each page
 $startpoint = ($pg * $perpage) - $perpage;
 $result = mysql_query("SELECT * FROM $where ORDER BY id ASC LIMIT $startpoint,$perpage");
 return $result;
               }
</code></pre>

<p>but when inserting in this function :</p>

<pre><code>function categories() { 

 selectWithPaging('category') 
 $text .='&lt;h2 class="mainH"&gt;Categories&lt;/h2&gt;';
 $text .= '&lt;table&gt;&lt;tr class="cn"&gt;&lt;td&gt;ID&lt;/td&gt;&lt;td class="name"&gt;Category&lt;/td&gt;  &lt;td&gt;Durum&lt;/td&gt;'; 
 while ($row = mysql_fetch_array($result)) {
 $home    = $row['home']; 
 $publish = $row['published'];
 $ID = $row['id'];
 $src = '&lt;img src="'.ADMIN_IMG.'homec.png"&gt;';
                      -------------
          }
</code></pre>

<p>there is this error:
supplied argument is not a valid MySQL result </p>

<p>What is wrong in my first function?</p>
