SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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 = '<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'));

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2011
    Posts
    70
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    A couple issues first any code should be wrappedin code or php tags for clarity

    PHP Code:
    <?

    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

    PHP Code:
    // 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.

    PHP Code:
    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 Code:
    <?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?

  3. #3
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello JeremyC

    thank you for your detailed informative reply,

    just what I needed!

    I have use your code modifications, and it works well

    thank you again

  4. #4
    SitePoint Enthusiast
    Join Date
    Mar 2011
    Posts
    70
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I'm glad it worked for you


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •