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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -