Code: Select all
global $gCms;
$db = $gCms->GetDb();
$query = 'SELECT * FROM action';
$dbr = $db->Execute($query);
Code: Select all
global $gCms;
$db = $gCms->GetDb();
$query = 'SELECT * FROM action';
$dbr = $db->Execute($query);
Well, this is what this function is actually meant for.aimerlamer wrote:
That simply connects you to the CMS database.
The variable does not have any issue.C7Mike wrote:
why the variable $this has issues
Code: Select all
$wpdbhost = 'localhost';
$wpdbuser = 'BLA_wp';
$wpdbpass = 'BLA';
$wpdbname = 'BLA_wp';
mysql_connect($wpdbhost, $wpdbuser, $wpdbpass) or die ('Error connecting to mysql');
mysql_select_db($wpdbname);
$vars = $gCms->variables;
$query2 = "SELECT BLA BLA_date DESC LIMIT 8";
$result2 = mysql_query($query2) or die("Error: " . mysql_error());
if( !$result2 )
{
echo 'DB error: '. $db2->ErrorMsg()."<br/>";
}
echo print_r($row, true);
echo '<ul>';
while($row = mysql_fetch_array( $result2 )) {
// Print out the contents of each row into a table
$date_format = $row["date_format"];
$post_title = $row["post_title"];
$post_name = $row["post_name"];
$post_excerpt = $row["post_excerpt"];
$post_content = $row["post_content"];
$postshort = myTruncate($post_content, 50);
echo "<li><a href='/blog/$date_format/$post_name/'>$post_title</a><br>";
echo "$postshort</li>";}
echo '</ul>';
//RECONNECT TO CMS MADE SIMPLE DB
$DIR = "/home/USERNAME/public_html";
// CMS database credentials are stored in db.class.php
require_once("$DIR/db.class.php");
// the key part is below
$db = new db;
$db->_open();