1

I have an external PHP file which updates mysql database (this file is connected with the main theme with jquery and ajax).

This is the simplified code from the ext file

<?php

$file = dirname(__FILE__);
$file = substr($file, 0, stripos($file, "wp-content") );

require( $file . "/wp-load.php");

if (something){echo ($var);}
else {echo ('eg97');}

?>

This is the result I get (when condition not met):

<!-- 
function add_jquery() 
{
    wp_enqueue_script( 'jquery' ); 
} 

add_action('wp_enqueue_scripts', 'add_jquery'); 
?> 

function open_mysql_db() 
{ 
    $mysqli = new mysqli('address of database', 'username', 'password', 'database name'); 
    // check connection 
    if (!$mysqli) 
        throw new Exception('Could not connect to database'); 
    else 
        return $mysqli; 
};
--> 97

All I want to get is 97 (or $var).

Any ideas?

4

0 回答 0