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?

4
  • 2
    Have a look at the syntax highlighting here and your error should become fairly obvious. Commented Feb 3, 2018 at 16:56
  • wrong quotes sequence Commented Feb 3, 2018 at 16:56
  • Please correct my query I'm stuck here for a long time Commented Feb 3, 2018 at 16:57
  • 3
    Possible duplicate of PHP Parse/Syntax Errors; and How to solve them? Commented Feb 3, 2018 at 17:00

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Worked Finally. But can you please answer ' ". varible." ' what is it mean?
' ". " ' 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.