0

at line 17 I've this line of code

$sq="insert into batch_content(bid,sid,joining_date) values('1','$_SESSION["id"]','$date');";

I can't figure what am I doing wrong?

MY PC
  • 151
  • 2
  • 12

1 Answers1

3

Wrong double quote sequence

$sq="insert into batch_content(bid,sid,joining_date) 
        values('1','" . $_SESSION["id"] ."','$date');";

but remeber that you are risk of sqlinject using php var in sql You should use binding_param .. so take a look at the sql driver you are using for this

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
  • Worked Finally. But can you please answer ' ". varible." ' what is it mean? – MY PC Feb 03 '18 at 17:03
  • 1
    ' ". " ' this mean that the string are concatenaed .. in PHP the dot `.` is for concatenating string .. so in your case you have double quote at start and double quotes around the index in SESSION and have error .. using string concatenation is common way for these situation ...but don't use var in sql .. look for binding param – ScaisEdge Feb 03 '18 at 17:09