MySQL Forums
Forum List  »  PHP

Re: mysql_num_rows(): supplied argument is not a valid MySQL result
Posted by: Barry Galbraith
Date: May 21, 2012 06:07PM

There's an extra ; in there, right afer the mysql_query(). Try this instead.

function runQuery($query) {
  $connect = mysql_connect(MYSQL_SERVER, MYSQL_USERNAME, MYSQL_PASSWORD)
             or exit( "<div class=\"error\">" . mysql_error() . "</div>" );
  mysql_select_db(MYSQL_DATABASE, $connect)
    or exit( "<div class=\"error\">" . mysql_error() . "</div>" );
  $result = mysql_query($query, $connect)
            or exit( "<div class=\"error\">" . mysql_error() . "</div>" );
  return $result;
}

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
Re: mysql_num_rows(): supplied argument is not a valid MySQL result
May 21, 2012 06:07PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.