TinyPortal

Development => Support => Topic started by: ChetUbetcha on June 05, 2007, 06:08:04 PM

Title: Help me get my right blocks to show again - PLEASE!
Post by: ChetUbetcha on June 05, 2007, 06:08:04 PM
First, I am developing in Dreamweaver and then converting some of the code to work in the portal.  Anyway, I created a PHP Article where people can submit information.  The display page for this information is being created in a block so I can limit access by membergroup.  Everything works fine for the display, but when I run the code with the following part

mysql_select_db($database_ngisdoportalDB, $ngisdoportalDB);
$query_report = "SELECT * FROM reports";
$report = mysql_query($query_report, $ngisdoportalDB) or die(mysql_error());
$row_report = mysql_fetch_assoc($report);
$totalRows_report = mysql_num_rows($report);


the front page displays the header row with a sliver of gray space where the block should be displaying items.  Also, the right blocks disappear.  If I remove that part of the code, everything works fine, minus the actual data being displayed in the table.

What do I need to do in order to get the whole thing to show with right side blocks and the actual data from the database?

global $txt, $scripturl, $user_info, $context, $modSettings, $ID_MEMBER, $board_info, $settings, $db_prefix, $options;

require_once(dirname(__FILE__) . '/ngisdoportalDB.php');

mysql_select_db($database_ngisdoportalDB, $ngisdoportalDB);
$query_report = "SELECT * FROM reports";
$report = mysql_query($query_report, $ngisdoportalDB) or die(mysql_error());
$row_report = mysql_fetch_assoc($report);
$totalRows_report = mysql_num_rows($report);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<form name="form1" method="POST">
<br />
  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="2">
    <tr>
      <td colspan="7"><strong>Awareness, Issues & Action Items </strong></td>
    </tr>
    <tr>
      <td bgcolor="#E0DFE3"> </td>
      <td bgcolor="#E0DFE3"> </td>
      <td bgcolor="#E0DFE3"><strong>Report Type </strong></td>
      <td bgcolor="#E0DFE3"><strong>Date</strong></td>
      <td bgcolor="#E0DFE3"><strong>AI Number </strong></td>
      <td bgcolor="#E0DFE3"><strong>Issue</strong></td>
      <td bgcolor="#E0DFE3"><strong>Status</strong></td>
    </tr>
    <?php do { ?>
<tr>
        <td width="5%"><p>
          <input type="hidden" name="hiddenField" value="<?php echo $row_report['id']; ?>"/>
          Modify</p></td>
        <td width="5%">Delete</td>
        <td width="15%"><?php if ($row_report['report_type'] == 'AI')
{
echo $row_report['report_type'];
}
?>
</td>
        <td width="14%"><?php echo $row_report['bullet_date']; ?></td>
        <td width="14%"><?php echo $row_report['ai_number']; ?></td>
        <td width="24%"><?php echo $row_report['ai_issue']; ?></td>
        <td width="25%"><?php echo $row_report['ai_status']; ?></td>
    </tr>
<?php } while ($row_report = mysql_fetch_assoc($report)); ?>
  </table>
   <br />
  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="2">
    <tr>
      <td colspan="6"><strong>All Other Report Sections </strong></td>
    </tr>
    <tr>
      <td bgcolor="#E0DFE3"> </td>
      <td bgcolor="#E0DFE3"> </td>
      <td bgcolor="#E0DFE3"><strong>Section</strong></td>
      <td bgcolor="#E0DFE3"><strong>Report Type </strong></td>
      <td bgcolor="#E0DFE3"><strong>Date</strong></td>
      <td width="41%" bgcolor="#E0DFE3"><strong>Bullet Text</strong> </td>
    </tr>
      <?php do { ?>
    <tr>
        <td width="5%"><p>Modify</p></td>
        <td width="5%">Delete</td>
        <td width="15%"><?php if ($row_report['section'] == 'Other') {
echo $row_report['other_text'];
}
else
{
echo $row_report['section'];}
?>
</td>
        <td width="17%"><?php echo $row_report['report_type']; ?></td>
        <td width="17%"><?php echo $row_report['bullet_date']; ?></td>
        <td><?php echo $row_report['bullet_text']; ?></td>
      </tr>
<?php } while ($row_report = mysql_fetch_assoc($report)); ?>
  </table>
</form>
</body>
</html>
<?php
mysql_free_result
($report);
Title: Re: Help me get my right blocks to show again - PLEASE!
Post by: ChetUbetcha on June 05, 2007, 06:55:30 PM
Here's what I'm getting in the error log

http://server/forum/index.php 
2: mysql_query(): supplied argument is not a valid MySQL-Link resource
File: /var/www/html/interactive/forum/Themes/default/TPortal.template.php (main_above sub template - eval?)
Line: 7

http://server/forum/index.php 
8: Undefined variable: ngisdoportalDB
File: /var/www/html/interactive/forum/Themes/default/TPortal.template.php (main_above sub template - eval?)
Line: 7

http://server/forum/index.php 
2: mysql_select_db(): supplied argument is not a valid MySQL-Link resource
File: /var/www/html/interactive/forum/Themes/default/TPortal.template.php (main_above sub template - eval?)
Line: 5

http://server/forum/index.php 
8: Undefined variable: ngisdoportalDB
File: /var/www/html/interactive/forum/Themes/default/TPortal.template.php (main_above sub template - eval?)
Line: 5

http://server/forum/index.php 
8: Undefined variable: database_ngisdoportalDB
File: /var/www/html/interactive/forum/Themes/default/TPortal.template.php (main_above sub template - eval?)
Line: 5

Title: Re: Help me get my right blocks to show again - PLEASE!
Post by: G6Cad on June 05, 2007, 07:04:37 PM
Seems like you have missed out the DB name for the code.
It needs to be shown where to get the information from the DB
Check the code and make sure it have the correct database name
Title: Re: Help me get my right blocks to show again - PLEASE!
Post by: Crip on June 05, 2007, 07:10:40 PM
I have saw this error if the -- tportal_version(); --  is missing or mis-spelled ?
Title: Re: Help me get my right blocks to show again - PLEASE!
Post by: ChetUbetcha on June 05, 2007, 07:24:16 PM
Quote from: G6â„¢ on June 05, 2007, 07:04:37 PM
Seems like you have missed out the DB name for the code.
It needs to be shown where to get the information from the DB
Check the code and make sure it have the correct database name
Where would I have missed the DB name for the code?  I have "reports" which is the table and the ngisdoportalDB.php is the connection page created by DW to call the database and table (which you already know) and it works fine for my other programs. 

I tried this though... I have a program using the same format in a LEFT block (built in DW, using the ngisdoportalDB.php file, etc.) that works fine.  I copied and pasted the exact same code in a new RIGHT block, but the only thing that shows up in the RIGHT block on the front page is the header/title bar.  The orignal (RIGHT block) works fine, but the newly created RIGHT block does not work.  Is there an issue calling the same ngisdoportalDB.php twice on one page?

If so, how do I call my connection to the DB table I want in Tiny Portal format?
Title: Re: Help me get my right blocks to show again - PLEASE!
Post by: ChetUbetcha on June 05, 2007, 07:24:31 PM
Quote from: crip~ on June 05, 2007, 07:10:40 PM
I have saw this error if the -- tportal_version(); --  is missing or mis-spelled ?

I'm missing the tportal_version() comment.  Please clarify (repeat in stupid-ese)  ;)
Title: Re: Help me get my right blocks to show again - PLEASE!
Post by: G6Cad on June 05, 2007, 07:39:10 PM
Well, to give you support on TP I will say you have to shut that block off you are trying to get to work.

That will bring the blocks back to your forum.
And for the block you have to ask from where you got it and for them to give you support on it.
Or hope that some one can help you if you post the question in the block code and snippets request board.
This board if for TP support. and for that i have given the answer, turn off the block with the non working mod snippet you have.
Title: Re: Help me get my right blocks to show again - PLEASE!
Post by: ChetUbetcha on June 06, 2007, 01:51:38 PM
Sorry for posting in the wrong forum.  :P

Anyway, using my method (aka the wrong way) calling the DB with the same name twice does not allow blocks to display correctly.  The first one will show, but the second one gets the aforementioned errors.  I finally created a block with limited access to certain membergroups and made articles with each program and they run fine.  I have some tweaks to make, but it's given me a workaround for my problem.

Just FYI.  :)