I know this is a very common question, and have found consistent answers online, but I can't seem to get this to work for me. I am trying to input:
Code:
<div id="394" class="ui-draggable item_outfit" style="left: 234px; top: 177px; width: 150px; height: 200px; position: absolute; display: block;"></div><div id="10" class="ui-draggable item_outfit" style="left:32px; top:392px; height:150px; width:300px; position:abolute; display:block;"></div>
into MySQL.
Here's what I've done:
Code:
$look = '<div id="394" class="ui-draggable item_outfit" style="left: 234px; top: 177px; width: 150px; height: 200px; position: absolute; display: block;"></div><div id="10" class="ui-draggable item_outfit" style="left:32px; top:392px; height:150px; width:300px; position:abolute; display:block;"></div>';
$look2 = htmlentities($look);
$look3 = html_entity_decode(htmlentities($look));
$look4 = mysql_real_escape_string($look);
$user_id = 34;
$query = "insert into user_outfits (user_id, div) values ($user_id, '" . mysql_real_escape_string($look) . "')";
echo $query;
$create_outfit = mysql_query($query);
I have tried the query with look (using mysql_real_escape_string()), look2, look3, and look4, to no avail. When I echo each look variable, only look2 is displayed correctly. Echoing look, look3 and look4 give me null values, and when I echo the query I get
Code:
insert into user_outfits (user_id, div) values (34, '
')
Why won't this insert into the database?
Thanks in advance.