Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Include in Include giving problems

    Hi,

    this is the test.php code:

    PHP Code:
    <?php
    include("news_config.php");
            
    $result mysql_query("SELECT * FROM news WHERE newsid='$newsid' ",$connect);
            
            echo 
    "<table width='440' border='0' cellspacing='0' cellpadding='0'>";
            
            while(
    $myrow mysql_fetch_assoc($result))
                 {

    echo 
    "<tr>";
    echo 
    "<td colspan='4'><img src='images/arrow2.gif' width='26' height='26'><img src='images/tutheaders/news.gif' width='414' height='26'></td>";
    echo 
    "</tr>";
    echo 
    "<tr bgcolor='#F0F0F0'>";
    echo 
    "<td colspan='4'></td>";
    echo 
    "</tr>";
    echo 
    "<tr>";
    echo 
    "<td width='75' rowspan='2'><img src='images/news.gif' width='75' height='75'></td>";
    echo 
    "<td width='10' rowspan='2' valign='top' bgcolor='#FFFFFF' class='style'><div align='left'></div></td>";
    echo 
    "<td width='320' height='20' bgcolor='#FFFFFF' class='style2'><div align='left'>";

            
    $txt1 $myrow['title'];
            
    $txt2 $myrow['dtime'];
            echo 
    $txt1 " (" $txt2 ")";

    echo 
    "</div></td>";
    echo 
    "<td width='10' rowspan='2' valign='middle' bgcolor='#FFFFFF'></td>";
    echo 
    "</tr>";
    echo 
    "<tr>";
    echo 
    "<td bgcolor='#FFFFFF' class='style1'>";

            echo 
    $myrow['text2'];

    echo 
    "</td>";
    echo 
    "</tr>";
    echo 
    "<tr bgcolor='#F0F0F0'>";
    echo 
    "<td colspan='4'></td>";
    echo 
    "</tr>";
    echo 
    "<tr bgcolor='#FFFFFF'>";
    echo 
    "<td colspan='4'></td>";
    echo 
    "</tr>";
    echo 
    "</table>";

                 }
    ?>
    And this is the index.php where the the test.php should include:

    PHP Code:
    <td width="440" rowspan="17" valign="top"><table width="440" border="0" cellspacing="0" cellpadding="0">
    <tr>
       <td>
          <?php include("test.php"?>
       </td>
    </tr>
    All the other includes work but this one doesn't, could be it that it has to do with the fact that test.php includes news_config.php?

    If it does or if it doesn't can anyone help me out with this? Thank you

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    What doesn't work on it? The query? Nothing printed out at all?

  • #3
    New Coder
    Join Date
    Jun 2005
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh sorry, it doesnt display the test.php include and whole my tables are messed up...

  • #4
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    The only thing wrong above that I saw was you are missing a semi-colon where you include test.php

    Are all the paths to the includes correct?

  • #5
    New Coder
    Join Date
    Jun 2005
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yep everything is correct, sorry for asking but do you have msn or something so i can show you?

  • #6
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There shouldn't be a problem nesting includes, I do it all the time. Where is $connect set in the test.php script, is it inside news_config.php?

    Maybe try putting an echo statement inside news_config.php and see if it echoes when you browse to index.php, if it does then the include is there at least. Also, maybe try setting error_reporting(E_ALL); and see if it's telling you about some error that might otherwise be surpressed.

  • #7
    New Coder
    Join Date
    Jun 2005
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok I'll try that when i'm home.


  •  

    Posting Permissions

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