{"id":1822,"date":"2018-10-23T20:26:40","date_gmt":"2018-10-23T20:26:40","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=1822"},"modified":"2022-02-17T07:14:02","modified_gmt":"2022-02-17T07:14:02","slug":"php7-updating-old-database-code","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/mysql\/php-versions\/php7-updating-old-database-code","title":{"rendered":"PHP7 updating old database code"},"content":{"rendered":"<h5>Database connections<\/h5>\n<p>Need updating to the method <a href=\"https:\/\/ibex.tech\/cloud\/mysql\/connecting\/connect-to-database\">here<\/a><\/p>\n<h5>Functions using the database connection or\u00a0mysql_real_escape_string<\/h5>\n<p>Any functions using the database connection will need &#8220;global $dblink;&#8221; as shown <a href=\"https:\/\/ibex.tech\/cloud\/mysql\/connecting\/functions-using-database-connection\">here<\/a><\/p>\n<h5>mysqli_real_escape_string<\/h5>\n<p>&#8220;mysql_real_escape_string(&#8221; all need updating to &#8220;mysqli_real_escape_string($dblink, &#8221; as shown\u00a0<a href=\"https:\/\/ibex.tech\/cloud\/mysql\/sanitising\/mysqli_real_escape_string\">here<\/a><\/p>\n<h5>mysql_query<\/h5>\n<p style=\"margin-left: 40px;\">For queries which have no result output, they are just do actions then replace &#8220;@mysql_query(&#8221; with &#8220;mysqli_query($dblink, &#8220;.<\/p>\n<p style=\"margin-left: 40px;\">For queries which produce results you&#8217;ll need to update them more manually with the mysqli\u00a0changes<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Database connections Need updating to the method here Functions using the database connection or\u00a0mysql_real_escape_string Any functions using the database connection will need &#8220;global $dblink;&#8221; as shown here mysqli_real_escape_string &#8220;mysql_real_escape_string(&#8221; all need updating to &#8220;mysqli_real_escape_string($dblink, &#8221; as shown\u00a0here mysql_query For queries which have no result output, they are just do actions then replace &#8220;@mysql_query(&#8221; with &#8220;mysqli_query($dblink, [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[153],"tags":[],"class_list":["post-1822","post","type-post","status-publish","format-standard","hentry","category-php-versions"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/1822","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=1822"}],"version-history":[{"count":9,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/1822\/revisions"}],"predecessor-version":[{"id":2925,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/1822\/revisions\/2925"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=1822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=1822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=1822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}