{"id":61,"date":"2011-02-28T23:29:42","date_gmt":"2011-03-01T05:29:42","guid":{"rendered":"http:\/\/www.marcblase.com\/blog\/?p=61"},"modified":"2011-04-13T11:28:01","modified_gmt":"2011-04-13T16:28:01","slug":"php-sessions","status":"publish","type":"post","link":"https:\/\/ma.rcbla.se\/blog\/2011\/02\/php-sessions\/","title":{"rendered":"PHP Sessions"},"content":{"rendered":"<p>Now I&#8217;m not sure this is due to the short comings of my coding skills or what. But I&#8217;ve found it necessary to re-declare session variables before including them in a MySQL INSERT statement.<\/p>\n<p>Here&#8217;s the (il)logic:<\/p>\n<pre><code>$_SESSION[\"mysessionarray\"] = arrary();<\/code><\/pre>\n<p>Push all $_POST variables, or what-have-you, into the array. Then prior to your INSERT statement:<\/p>\n<pre><code>$myvar = $_SESSION[\"mysessionarray\"][\"myvar\"];<\/code><\/pre>\n<p>Use your new $myvar in your MySQL INSERT<\/p>\n<p>EDIT: Um, rookie mistake 101. Should&#8217;ve just escaped the quotes in the $_SESSION vars. My bad.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now I&#8217;m not sure this is due to the short comings of my coding skills or what. But I&#8217;ve found it necessary to re-declare session variables before including them in a MySQL INSERT statement. Here&#8217;s the (il)logic: $_SESSION[&#8220;mysessionarray&#8221;] = arrary(); Push all $_POST variables, or what-have-you, into the array. Then prior to your INSERT statement: [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,3],"tags":[16],"class_list":["post-61","post","type-post","status-publish","format-standard","hentry","category-coding","category-discoveries","tag-php"],"_links":{"self":[{"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/posts\/61","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/comments?post=61"}],"version-history":[{"count":3,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/posts\/61\/revisions"}],"predecessor-version":[{"id":73,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/posts\/61\/revisions\/73"}],"wp:attachment":[{"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/media?parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/categories?post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/tags?post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}