How to add a table to this php page

Hello

I have php page that I would like to add a table to, Original php page in Black & Blue.

At the moment this table code is not working/correct.

I would like the table below $template->set(‘members_area_header’, header7(MSG_MEMBERS_AREA_TITLE));

your help appreciated.

<?

session_start();

define (‘IN_SITE’, 1);

include_once (‘includes/global.php’);
include_once (‘includes/class_formchecker.php’);
include_once (‘includes/class_custom_field.php’);
include_once (‘includes/class_user.php’);
include_once (‘includes/class_fees.php’);
include_once (‘includes/class_item.php’);

if (!$session->value(‘user_id’))
{
header_redirect(‘login.php’);
}
else
{
require (‘global_header.php’);

//$msg_changes_saved = '&lt;p align="center" class="contentfont"&gt;' . MSG_CHANGES_SAVED . '&lt;/p&gt;';

[COLOR="#0000CD"]$template-&gt;set('members_area_header', header7(MSG_MEMBERS_AREA_TITLE));[/COLOR]

<table width=“100%” cellpadding=“3” cellspacing=“1” class=“errormessage”>
<tr class=“contentfont”>
<td class=“c3” align=“center” colspan=“5”><strong><?=MSG_PENDING_GC_PAYMENTS;?></strong></td>
</tr>
<tr class=“contentfont”>
<td width=“100%”><b><?=GMSG_DESCRIPTION;?></b></td>
<td nowrap align=“center”><b><?=MSG_PAYMENT_TO;?></b></td>
<td nowrap align=“center”><strong><?=GMSG_AMOUNT;?></strong></td>
<td nowrap align=“center”><strong><?=MSG_PAYMENT_DATE;?></strong></td>
<td nowrap align=“center”><strong><?=MSG_PAYMENT_TYPE;?></strong></td>
</tr>
<?=$pending_gc_transactions_content;?>
</table>
<? } ?>

$user_details = $db-&gt;get_sql_row("SELECT * FROM " . DB_PREFIX . "users WHERE user_id=" . $session-&gt;value('user_id'));

A couple issues first any code should be wrappedin code or php tags for clarity

<?

session_start();

define ('IN_SITE', 1);

include_once ('includes/global.php');
include_once ('includes/class_formchecker.php');
include_once ('includes/class_custom_field.php');
include_once ('includes/class_user.php');
include_once ('includes/class_fees.php');
include_once ('includes/class_item.php');

if (!$session->value('user_id'))
{
header_redirect('login.php');
}
else
{
require ('global_header.php');

//$msg_changes_saved = '<p align="center" class="contentfont">' . MSG_CHANGES_SAVED . '</p>';

$template->set('members_area_header', header7(MSG_MEMBERS_AREA_TITLE));

<table width="100%" cellpadding="3" cellspacing="1" class="errormessage">
<tr class="contentfont">
<td class="c3" align="center" colspan="5"><strong><?=MSG_PENDING_GC_PAYMENTS;?></strong></td>
</tr>
<tr class="contentfont">
<td width="100%"><b><?=GMSG_DESCRIPTION;?></b></td>
<td nowrap align="center"><b><?=MSG_PAYMENT_TO;?></b></td>
<td nowrap align="center"><strong><?=GMSG_AMOUNT;?></strong></td>
<td nowrap align="center"><strong><?=MSG_PAYMENT_DATE;?></strong></td>
<td nowrap align="center"><strong><?=MSG_PAYMENT_TYPE;?></strong></td>
</tr>
<?=$pending_gc_transactions_content;?>
</table>
<? } ?>

$user_details = $db->get_sql_row("SELECT * FROM " . DB_PREFIX . "users WHERE user_id=" . $session->value('user_id'));

Secondly
You should not use short tags

 
// incorrect
<? ?> 
<?=MSG_PAYMENT_TYPE ?> 

// correct
<?php ?>
<?php echo MSG_PAYMENT_TYPE ?>

I have changed a few things in your script below. I replaced all short tags with <?php echo $var ?>. Also when you want to use html php you must leave php to enter the html unless you echo it out. Also the $user_details variable assignment was outside the php tags.


if( $x == $y)
{
   //code here
} 
else
{
    // do something
?>
    html here <?php echo $x; ?>
<?php
   //do somehthing
} // else

This is a best guess based on what I think your trying to accomplish. What error message is it giving you?

<?php

session_start();

define ('IN_SITE', 1);

include_once ('includes/global.php');
include_once ('includes/class_formchecker.php');
include_once ('includes/class_custom_field.php');
include_once ('includes/class_user.php');
include_once ('includes/class_fees.php');
include_once ('includes/class_item.php');

if (!$session->value('user_id'))
{
    header_redirect('login.php');
}
else
{
    require ('global_header.php');

    //$msg_changes_saved = '<p align="center" class="contentfont">' . MSG_CHANGES_SAVED . '</p>';
    
    $template->set('members_area_header', header7(MSG_MEMBERS_AREA_TITLE));
?>

    <table width="100%" cellpadding="3" cellspacing="1" class="errormessage">
        <tr class="contentfont">
            <td class="c3" align="center" colspan="5"><strong><?php echo MSG_PENDING_GC_PAYMENTS; ?></strong></td>
        </tr>
        <tr class="contentfont">
            <td width="100%"><b><?php echo GMSG_DESCRIPTION;?></b></td>
            <td nowrap align="center"><b><?php echo MSG_PAYMENT_TO; ?></b></td>
            <td nowrap align="center"><strong><?php echo GMSG_AMOUNT; ?></strong></td>
            <td nowrap align="center"><strong><?php echo MSG_PAYMENT_DATE; ?></strong></td>
            <td nowrap align="center"><strong><?php echo MSG_PAYMENT_TYPE; ?></strong></td>
        </tr>
        <?php echo $pending_gc_transactions_content;?>
    </table>
<?php 

} // end else

    $user_details = $db->get_sql_row("SELECT * FROM " . DB_PREFIX . "users WHERE user_id=" . $session->value('user_id'));
    
?>

Does this help?

Hello JeremyC

thank you for your detailed informative reply,

just what I needed!

I have use your code modifications, and it works well :slight_smile:

thank you again :slight_smile:

I’m glad it worked for you :slight_smile: