php - store a session variable into mysql -
right have this:
session_start() $_session['title'] = $_post['title'];
i store variable jquery preserved in php session, question ...using mysql_query()...how store session variable in database? i've been trying find out proper way without getting empty value
the full query:
mysql_query("insert titles (content, type, url, title) values ('$content','7',$url',".mysql_real_escape_string($_session['title'])."')");
here jquery :
var title = $(".hidden").text(); $.post("tosqltwo.php", { title: title} ); var url = $(".hide").text(); $(".button").click(function() { var content = $(this).siblings().outerhtml(); $.ajax({ type: "post", url: "tosqltwo.php", data: { content: content, url: url } }); });
i able content, url , type. title remains empty
you can store session variable other variable, zerkms said
mysql_query("insert titles (title) values ('".mysql_real_escape_string($_session['title'])."')");
in case
mysql_query("insert titles (content, type, url, title) values ('".mysql_real_escape_string($content)."','7','".mysql_real_escape_string($url)','".mysql_real_escape_string($_session['title'])."')");
Comments
Post a Comment