Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAndrew McCombs
4,309 PointsSQL Query Help
The Database is Users The table im working with is fourm_post And the information im updating is the post_body
UPDATE forum_post
SET post_body = '$edit_post_body'
WHERE id = '$post_id'
AND post_author = '$post_author'
AND type = '$post_type'
3 Answers
Gregory Serfaty
37,140 PointsDelete the simple quote between all yours variables
Gregory Serfaty
37,140 PointsYou need to do like this the single quote does not interpret php if you do this '$var' for php you write a string $var
"UPDATE forum_post SET post_body = '".$edit_post_body."' WHERE id = '".$post_id."' AND post_author = '".$post_author."' AND type = '".$post_type."'"
Andrew McCombs
4,309 PointsI have a website, and every query I have use '$post_body' so that cant be the problem
Gregory Serfaty
37,140 Pointsafter that maybe you have a quote in your variable so you need to escape your variable (addslashes etc...) what is the content of yours variables you use mysql_query? look PDO
Andrew McCombs
4,309 PointsAndrew McCombs
4,309 PointsYou mean remove the ' ' - Dont you need those if you are using php var