Question: I get the below error when I open mypost.php file, any advice? Fatal error : Uncaught mysqli_sql_exception: You have an error in your SQL syntax;

I get the below error when I open mypost.php file, any advice?

Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 in C:\xampp\htdocs\books\mypost.php:23 Stack trace: #0 C:\xampp\htdocs\books\mypost.php(23): mysqli_query(Object(mysqli), 'SELECT * FROM p...') #1 {main} thrown inC:\xampp\htdocs\books\mypost.phpon line23

ProjectX

My Posts!

include 'partials/dbconnect.php';

#session_start();

$e_id = $_SESSION['uid'];

$sql="SELECT * FROM postbook WHERE usenam=$e_id";

$result = mysqli_query($conn,$sql);

while($row=mysqli_fetch_assoc($result))

{

$bok_n=$row['b_name'];

$og_pr=$row['og_pr'];

$ex_pr=$row['ex_pr'];

$time=$row['dt_creation'];

$pic=$row['pic1'];

$p_id=$row['p_id'];

echo '

'.$bok_n.'

Original Price: '.$og_pr .'

Expected Price: '.$ex_pr .'

Last updated '.$time.'

';

}

?>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!