Easy to Work with WordPress using Oracle Database
691
post-template-default,single,single-post,postid-691,single-format-standard,qode-quick-links-1.0,,qode_grid_1200,qode_popup_menu_push_text_right,qode-content-sidebar-responsive,columns-3,qode-child-theme-ver-1.0.0,bridge-child,wpb-js-composer js-comp-ver-5.1.1,vc_responsive
 

How to Work with WordPress Using Oracle Database?

How to Work with WordPress Using Oracle Database?

Sometimes it might be a bit intimidating for WordPress developers to work using Oracle database. As most of the developers don’t know about the process and usually most of the blogs says ‘NO’ for Oracle DB. Here’s the solution of the problem to help you work with Word Press using Oracle DB.

Below you may find the function to create a connection, do a query and show the results (example uses the Resources schema that comes with Oracle Express):

 

function MyOracleConnection ()

{

$conn = oci_connect(‘hr’, ‘tester’, ‘localhost/XE’);

if (!$conn) {

$e = oci_error();

trigger_error(htmlentities($e[‘message’], ENT_QUOTES), E_USER_ERROR);

}

else     {

echo ‘<p>Congrats: Oracle meets WordPress!</p>’;

}

 

// Prepare the statement

$stid = oci_parse($conn, ‘SELECT * FROM departments’);

if (!$stid) {

$e = oci_error($conn);

trigger_error(htmlentities($e[‘message’], ENT_QUOTES), E_USER_ERROR);

}

 

// Perform the logic of the query

$r = oci_execute($stid);

if (!$r) {

$e = oci_error($stid);

trigger_error(htmlentities($e[‘message’], ENT_QUOTES), E_USER_ERROR);

}

 

// Fetch the results of the query

print “<table border=’1′>\n”;

while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {

print “<tr>\n”;

foreach ($row as $item) {

print ”    <td>” . ($item !== null ? htmlentities($item, ENT_QUOTES) : “&nbsp;”) . “</td>\n”;

}

print “</tr>\n”;

}

print “</table>\n”;

 

oci_free_statement($stid);

oci_close($conn);

}

Also Read>> HOW THE NEW RESPONSIVE GANTRY 5 FRAMEWORK IS CRUCIAL FOR ADVANCED VERSION OF JOOMLA AND WORDPRESS?

You can then use this function in your WordPress template to do the magic. If you still face any difficulty, you may contact our WordPress Developers for Support here https://www.ost.agency/contactus.html

Latest Blogs