title: mysqli query with mysql function inside
body: <p>I'm trying to produce a passfrase on the database with a function I found somewere.
  If i use the sql query directly on the database it produces a string as desired, but in my php page it gives the <strong>error</strong>: </p>
  
  <blockquote>
    <p>"<strong>Fatal error</strong>: Uncaught Error: Call to a member function fetch_array()
    on boolean"</p>
  </blockquote>
  
  <pre><code>$query_rsCaptchaID = "DELIMITER $$
  DROP FUNCTION IF EXISTS `randomPasswordGenerator` $$
  CREATE FUNCTION `randomPasswordGenerator`(
    ) RETURNS varchar(64) CHARSET utf8
  BEGIN
    DECLARE charCount TINYINT(1) DEFAULT 0;
    DECLARE charDiceRoll TINYINT(2);
    DECLARE randomChar CHAR(1);
    DECLARE randomPassword CHAR(64) DEFAULT '';
    REPEAT
      SET charCount = charCount + 1;
      SET charDiceRoll = 1 + FLOOR(RAND() * 94);
      IF (charDiceRoll &lt;= 32)
      THEN
        SET randomChar = ELT(charDiceRoll,
        '`', '~', '!', '@', '#', '$', '%', '^',
        '&amp;', '*', '(', ')', '-', '=', '_', '+',
        '[', ']', '{', '}', '\\', '/', '|', '?',
        ';', ':', '\'', '\"', ',', '.', '&lt;', '&gt;');
      ELSEIF (charDiceRoll &gt;= 33)
        AND (charDiceRoll &lt;= 68)
      THEN
        SET charDiceRoll = charDiceRoll - 33;
        SET randomChar = CONV(
          charDiceRoll,
          10, 36);
      ELSE
        SET charDiceRoll = charDiceRoll - 59;
        SET randomChar = LOWER(
          CONV(
            charDiceRoll,
            10, 36)
        );
      END IF;
      SET randomPassword = CONCAT(randomPassword, randomChar);
    UNTIL (charCount = 64)
    END REPEAT;
    RETURN randomPassword;
  END $$
  DELIMITER ;
  SELECT randomPasswordGenerator() AS captchaID;";
  $rsCaptchaID = mysqli_query($db,$query_rsCaptchaID);
  $row_rsCaptchaID = $rsCaptchaID-&gt;fetch_array();
  </code></pre>
  
  <p>Any ideas anyone? I´m quite new on MySQLi, and not english speaking, sorry for errors.</p>