title: Creating a function to retrieve information from SQL
body: <p>I've searched the site for an answer but couldn't find any answer for my specific problem that worked.
  I have two files, the first one is my index.php of-course, the second is my functions.php file, which obviously contains the functions, I made this function:</p>
  
  <p>function sql_get($lang, $tabler, $rower){</p>
  
  <pre><code>if ($lang == "heb") { 
      $result = mysql_query("SELECT * FROM %s WHERE id = 0",
          mysql_real_escape_string($tabler));
      $row = mysql_fetch_array($result);
      return $row['$rower'];
  }
  
  else if ($lang == "rus") { 
      $result = mysql_query("SELECT * FROM %s WHERE id = 0",
          mysql_real_escape_string($tabler));
      $row = mysql_fetch_array($result);
      return $row['$rower'];
  }
  </code></pre>
  
  <p>this code supposed to get an information about the language (from a get, it gets it, it's all fine with that), the sql table and the specific row from this table where the id is 0.</p>
  
  <p>and return the information from the row inserted.</p>
  
  <p>My warnings and errors when the language is "heb":</p>
  
  <pre><code>Warning: mysql_query() expects parameter 2 to be resource, string given in /home/elenbyin/public_html/elenby.co.il/vadim/functions.php on line 16
  
  Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /home/elenbyin/public_html/elenby.co.il/vadim/functions.php on line 17
  </code></pre>
  
  <p>and when the language is "rus":</p>
  
  <pre><code>Warning: mysql_query() expects parameter 2 to be resource, string given in /home/elenbyin/public_html/elenby.co.il/vadim/functions.php on line 23
  </code></pre>
  
  <p>Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /home/elenbyin/public_html/elenby.co.il/vadim/functions.php on line 24</p>
  
  <p>the function call in the index.php file looks like that: </p>
  
  <p>I will be thankful for the people who will try to help and especially for those who will help me.</p>
  
  <p>Thanks A lot!</p>