php not working?

1Tsme1941

Member
<html><body>
<hr>
<center><b><font size=+2> 515 Certification Expiration Report</font><br>06/22/2020 - 06/22/2021<p>

<hr>
//Open a new connection to the MySQL server
require_once "getprerentdb.php";

//MySqli Select Query
$results = $mysqli->query ('SELECT * FROM `waitlist`');
?>
<table border=1>
<th>unit#</th>
<th>resident name</th>
<th>movein date</th>
<th>effect date</th>
<th>expire date</th>
<th>days left</th>
<th colspan=3>recertification notification</th>
</tr>

<?php
// ---------------------------------------
while($row = mysqli_fetch_array($results))
{
// ----------------------------------------
echo "<tr>";
echo "<td>" . $row['apt'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['moveindate'] . "</td>";
echo "<td>" . $row['effdate'] . "</td>";
echo "<td>" . $row['expdate'] . "</td>";
echo "<td>" . $row['daysleft'] . "</td>";
echo "<td>" . $row['90date'] . "</td>";
echo "<td>" . $row['60date'] . "</td>";
echo "<td>" . $row['30date'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
</body></html>
----------------------------------------------
gets result:
515 Certification Expiration Report
06/22/2020 - 06/22/2021



//Open a new connection to the MySQL server require_once "getprerentdb.php"; //MySqli Select Query $results = $mysqli->query ('SELECT * FROM `waitlist`'); ?>
Notice: Undefined variable: results in C:\xampp\htdocs\property\certlog.php on line 24

Warning
: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:\xampp\htdocs\property\certlog.php on line 24

unit#resident namemovein dateeffect dateexpire datedays leftrecertification notification
 

Cromewell

Administrator
Staff member
Anything from mysqli_error($mysqli) and/or mysqli_connect_error()? Guessing your connection failed but I can't tell.
 

1Tsme1941

Member
this is current code:
<?php
error_reporting(E_ALL ^ E_NOTICE);
// error_reporting(0);
$DB_NAME = 'prerentdb'; $DB_HOST = 'localhost';
$DB_USER = 'root'; $DB_PASS = '';
$mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
if (mysqli_connect_errno())
{printf("Connect failed: %s\n", mysqli_connect_error());exit();}
?>
--------------------------------------------------------------------
and:
<html><body>
<hr>
<center><b><font size=+2>

515 Certification Expiration Report</font><br>06/22/2020 - 06/22/2021<p>

<hr>
//Open a new connection to the MySQL server
require_once "getprerentdb.php";

//MySqli Select Query
// -------------------------------------------------------
$results = $mysqli->query ('SELECT * FROM `waitlist`');
// -----------------------------------------------------
?>
<table border=1>
<th>unit#</th>
<th>resident name</th>
<th>movein date</th>
<th>effect date</th>
<th>expire date</th>
<th>days left</th>
<th colspan=3>recertification notification</th>
</tr>

<?php
// ---------------------------------------
while($row = mysqli_fetch_array($results))
// ----------------------------------------
{

echo "<tr>";
echo "<td>" . $row['apt'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['moveindate'] . "</td>";
echo "<td>" . $row['effdate'] . "</td>";
echo "<td>" . $row['expdate'] . "</td>";
echo "<td>" . $row['daysleft'] . "</td>";
echo "<td>" . $row['90date'] . "</td>";
echo "<td>" . $row['60date'] . "</td>";
echo "<td>" . $row['30date'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
</body></html>
-----------------------------------------------
and result:
515 Certification Expiration Report
06/22/2020 - 06/22/2021



//Open a new connection to the MySQL server require_once "getprerentdb.php"; //MySqli Select Query // ------------------------------------------------------- $results = $mysqli->query ('SELECT * FROM `waitlist`'); // ----------------------------------------------------- ?>
Notice: Undefined variable: results in C:\xampp\htdocs\property\certlog.php on line 26

Warning
: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:\xampp\htdocs\property\certlog.php on line 26

unit#resident namemovein dateeffect dateexpire datedays leftrecertification notification
 
Top