I’m engaged on a wordpress web site, and began implanting a CRUD database. I coded out an instance that works completely on my localhost. Nevertheless, I’m working with file mangaer in cpanel, and am having problem with altering the common database question to a one that’s integrated with $wpdb. I’ve tried to make use of $wpdb->get_results(), however I get the identical error. Any assist can be significantly appreciated.
Right here is my code:
// CONNECTION TO DATABASE
$question = "SELECT * FROM college students";
$query_results = mysqli_query($wpdb->dbh, $question) or die(mysqli_error($wpdb->dbh));
if(mysqli_num_rows($query_results) > 0)
{
foreach($query_run as $scholar)
{
?>
echo '
<type id="saveStudent">
<tr>'
echo '<td>'<?php $student->id; ?> echo '</td>';
echo '<td>'<?php $student->first_name; ?> echo '</td>';
echo '<td>'<?php $student->last_name; ?> echo '</td>';
echo '<button sort="button" class="btn btn-danger">Delete Scholar</button>'
echo '</tr>';
<?php
}
}
?>
EDIT: The error message I get is Warning: mysqli_query() expects parameter 1 to be mysqli, null given