View Full Version : Little help with php code read MySQL data base

04-20-2009, 11:42 AM

1. I have one webdomain, for example: www.mydomain.com, when I installed php-fusion v.7.
2. I have one sub domain web, for example: forum.mydomain.com, when I installed Invision Power Board forum v.2.3.6.

I want php-fusion panel to read and display last five active topic from Invision Power Board forum. And the Invision Power Board forum has own MySQL database. So, I have two MySQL database: PHP-Fusion and Invision Power Board.

In php-fusion, at the option of creating a new panel, is displayed:

echo "content";

I replaced "content" of the php code posted above, with the following php code should read the MySQL database called IPB Forum: forumel_phpb1. Therefore, result:

echo "
global $forumel, $phpb1, $forum;

$result = $db->sql_query("SELECT forum_id, topic_id, topic_title FROM ".$prefix."_bbtopics ORDER BY topic_time DESC LIMIT 5");
$content = "<br>";
while ($row = $db->sql_fetchrow($result)) {
$forum_id = intval($row['forum_id']);
$topic_id = intval($row['topic_id']);
$topic_title = $row['topic_title'];
$row2 = $db->sql_fetchrow($db->sql_query("SELECT auth_view, auth_read FROM ".$prefix."_bbforums WHERE forum_id='$forum_id'"));
$auth_view = intval($row2['auth_view']);
$auth_read = intval($row2['auth_read']);
if (($auth_view < 2) OR ($auth_read < 2)) {
$content .= "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\">&nbsp;<a href=\"modules.php?name=Forums&amp;file=viewtopic&amp;t=$topic_id\">$topic_title</a><br>";

$content .= "<br><center><a href=\"modules.php?name=Forums\"><b>$sitename Forums</b></a><br><br></center>";

The php code above don't works and I don't know why??? So, I want to tell me what was wrong or what you should add in the php code above to read the MySQL database Invision Power Board? I want php-fusion to be displayed only five titles last active forum topics.

Little help please.

04-21-2009, 05:01 PM
UP! anyone! Please.

04-21-2009, 06:50 PM
Does your $db object report query errors?

04-21-2009, 07:11 PM
Do not report any error. I just tried to implement a code to read and display the latest IPB active topics in a panel php-fusion, but the php code, which we exposed above, does not work. So...

04-21-2009, 07:45 PM
I'm sorry I wasn't clear-- my question is, is your $db object written to report errors when they happen? In other words, is there an error happening with your script that you aren't seeing because $db isn't reporting it?

04-21-2009, 08:39 PM
I understand what you ask me but I do not know what to answer. I do not know because I don't know very well "the problem".

Have you ever worked with php-fusion? I ask this because to understand what I did and presented the first script above should have worked with CMS php-fusion. In another train of thoughts, above, we tried to implement a php code in a php-fusion panel that reads the MYSQL Invision Power Board. The problem is: we have not succeeded, an error that displays the CMS when I try implement php code above are:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/mydomain/public_html/administration/panel_editor.php(128) : eval()'d code on line 5

So, I need help to correct the errors in php code above.

And please excuse my english.