Hi there guys,
I wrote a very small script to show a random testimonial, and when I view it as it's own page, it operates as planned, and no problems arise.
But when I attempt to include it in a forum system, it breaks the forum system.
I know you can't be expected to know how different forum systems operate, but I was hoping someone might see something in my script that is causing my problem, and my problem is(From the error), it looks like my script has caused the forum to think that the data is in my script's database, and it's no longer using the forum database.
Here's my script:
include("config.php");
/*this query will get the needed information to create the block as you would like it*/
$result = mysql_query('SELECT * FROM config') or exit(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
$debug = $row['debug'];
$block_width = $row['block_width'];
$block_scroll = $row['block_scroll'];
$block_showtitle = $row['block_showtitle'];
$block_showdate = $row['block_showdate'];
$block_showauth = $row['block_showauth'];
$block_showauthweb = $row['block_showauthweb'];
$block_titlecount = $row['block_titlecount'];
$block_textcount = $row['block_textcount'];
if('debug'==1){
error_reporting(E_ALL);
}
/* this query will get a random testimonial result */
$query = "select * from testimonials WHERE active=1 ORDER BY rand() LIMIT 1";
$result = mysql_query ($query);
while ($row = mysql_fetch_assoc ($result)) {
/* display testimonials in a simple table */
$id = $row['id'];
$postdate = $row['postdate'];
$author = stripslashes ($row['author']);
$authorweb = stripslashes ($row['authorweb']);
$authorwebname = stripslashes ($row['authorwebname']);
$title2 = stripslashes ($row['title']);
$testtext1 = stripslashes ($row['testtext']);
$testtext2 = strip_tags ($testtext1);
//global $block_textcount, $block_titlecount;
function nicetrim ($s, $length) {
$str_to_count = html_entity_decode($s);
if (strlen($str_to_count) <= $length) {
return $s;
}
$s2 = substr($str_to_count, 0, $length);
$s2 = substr($str_to_count, 0, $length - 3);
$s2 .= "... [More]";
return htmlentities($s2);
}
$testtext = nicetrim($testtext2, $block_textcount);
$title = nicetrim($title2, $block_titlecount);
/* display the data */
echo("<div align=center>
<table width=260 border=1 cellpadding=1 cellspacing=1>");
if($block_showtitle == 1) {
echo("<tr>
<td bgcolor='#ffffff' width=400>
<font size=3><b>$title</b></font>
</td>
</tr>");
}
echo(" <tr>
<td bgcolor='#ffffff'>
<font size=2>$testtext</font><p>
</td>
</tr>");
if($block_showauth == 1) {
echo("<tr>
<td align='right'>
<font size='1'>$author</font>
</td>
</tr>");
}
if($authorweb != "") {
if($block_showauthweb == 1) {
echo("<tr>
<td align='right'>
<font size='1'><a href='$authorweb' target='_blank'>$authorwebname</a></font>
</td>
</tr>");
}
}
echo("<tr>
<td bgcolor='#ffffff'>
<font size=2>");
include("$siteurl/includes/menu/menu.php");
echo("</font><p>
</td>
</tr>
</table>
</div><br>
<br>
");
}
}
The page gets called in the navigation pane of the forum application. When a page that shows it gets called, everything to my script shows properly, but immediately after my script, I get this error:
Fatal error: Database error: 1146: Table 'roughing_automonial.v_pm' doesn't exist - File: /home/roughing/public_html/templates/1/header.html(54) : eval()'d code on line 26 in /home/roughing/public_html/classes/database/mysql.inc.php on line 291
roughing_automonial is my script's database. Up until my script got called, it was pulling the forum data from roughing_portal.
What do I need to do to make my script allow the parent application to continue working after running it?
Any help would be greatly appreciated.
thanks,
json