Hey Guys,
New to the Forum. I don't know what to do about this error im getting
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in
Here is the Code:
<?php
session_start();
if (isset($_POST['title'])){
$username = $_POST['title'];
$firstname = $_POST['postbody'];
}
// Connect to database
include_once "scripts/connect_to_mysql.php";
if (isset($_SESSION['id'])) {
$id = $_SESSION['id'];
} else {
print "You Are Not Allowed to Create a Blog Post";
}
// Get Username
$sql= mysqli_query($myConnection, "SELECT * FROM member WHERE id = '$id'");
while($row = mysqli_fetch_array($sql))
{
$username= $row['username'];
}
//Check if allowed
$sqlcheck= mysqli_query($myConnection, "SELECT account_type FROM member WHERE id= '$id' ");
while($row = mysqli_fetch_array($sqlcheck)){
$acc_type= $row["account_type"];
}
if ($acc_type == 'b'){
$sqlinsert= mysqli_query ($myConnection, "INSERT INTO blogpost ( title, dateposted, pagebody)
VALUES('$title',now(),'$postbody'")
or die (mysqli_error($myConnection));
}
?>