0

I am passing a ajax request to php page and alert the response.

php file contains below line

$sql2 = "INSERT  INTO `post_tags` (`post_id`, `tag`) VALUES (".$mysqli->insert_id.", ".$tag.")";
echo $sql2;

I get the alert. But the sql query is wrong because I need to pass $tag as string as tag is a varchar in sql.

So when I replace the php code with

$sql2 = "INSERT  INTO `post_tags` (`post_id`, `tag`) VALUES (".$mysqli->insert_id.", '".$tag."')";
echo $sql2;

It inserts the data successfully in the table. But I am not getting any data in return. What may be the issue?

And is there some way to debug these kind of issues? i.e to find php errors from front end?

Cœur
  • 37,241
  • 25
  • 195
  • 267
tarun14110
  • 940
  • 5
  • 26
  • 57

0 Answers0