When using MySQLi_query
you need to pass also the database handle $dbh
, or link, that you established with the call to MySQLi_connect
.
So, for example:
$dbh = MySQLi_connect ("localhost", "trbncom_main", "password!") or die ('I cannot connect to the database because: ' . MySQLi_error());
MySQLi_select_db ($dbh, "trbncom_main");
$sql="select * from members where active='on' and mmonth='$renewalmonth' and mdate='$renewaldate'";
$result=MySQLi_query($dbh, $sql);
...
Check documentation carefully: this is easy to miss. Hope this helps.