TechGuy1 Posted April 3, 2011 Share Posted April 3, 2011 I am a php noob. I am trying to build a newsletter system and this script is suppose to give me a list of names, emails and id of the subscribers in the newsletter table. I am actually following along with a tutorial and I have the exact code they have but I am getting the following errors.. Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, resource given in C:\xampp\htdocs\myprojects\newsletterremove.php on line 24 Warning: mysqli_close() expects parameter 1 to be mysqli, resource given in C:\xampp\htdocs\myprojects\newsletterremove.php on line 32 here is the code <?php //Connect to database include('database.php'); if(isset($_POST['submit'])){ foreach($_POST['todelete'] as $delete_id){ $query = "DELETE FROM newsletter WHERE id = $delete_id"; mysql_query($query) or die('Error Querying Database'); } echo 'Client(s) removed.<br />'; } // Display the customer rows with checkboxes for deleting $query = "SELECT * FROM newsletter"; $result = mysql_query($query); while ($row = mysqli_fetch_array($result)) { echo '<input type="checkbox" value="' . $row['id'] . '" name="todelete[]" />'; echo $row['first_name']; echo ' ' . $row['last_name']; echo ' ' . $row['email']; echo '<br />'; } mysqli_close($connection); ?> Quote Link to comment https://forums.phpfreaks.com/topic/232569-mysqli_fetch_array-expects-parameter-1-to-be-mysqli_result/ Share on other sites More sharing options...
Pikachu2000 Posted April 3, 2011 Share Posted April 3, 2011 You're mixing mysql and mysqli extension functions. They aren't interoperable. Quote Link to comment https://forums.phpfreaks.com/topic/232569-mysqli_fetch_array-expects-parameter-1-to-be-mysqli_result/#findComment-1196282 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.