turkman Posted June 28, 2008 Share Posted June 28, 2008 I dont even know how to label this correctly. Basically i have a website on my intranet. With a link that takes you to a new page called contacts.php contacts.php looks like this <?php include 'includes/tpl_vtop.html'; include 'includes/tpl_header.html'; include 'includes/tpl_lcol.html'; ?> <div id="ccol"> <div id="ccolhdr"><div class="hdrtxt">Contacts</div></div> <div id="cleft> <?php 'include maincon_contact.php'; ?> </div> <div id="cright></div> </div> <?php include 'includes/tpl_footer.html'; include 'includes/tpl_copyw.html'; include 'includes/tpl_vbottom.html'; ?> This is mostly includes to bring in the header footer etc, but in the main content box i call the maincon_contact.php script, this is a very basic script that connects to a database and displays the result. it looks like this <?php include'usephp/conf.php'; include 'usephp/opendb.php'; $query = "SELECT * FROM contacts"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "Name: {$row['cname']} " . "Email: </strong></td><td>{$row['cemail']}"; } include 'usephp/closedb.php'; ?> The idea being that contact will be formatted exactly like my index page (which works) and that the result of maincon_contact will be displayed in the ccol div (which dosent work). When i go to contact the ccol div is left blank and nothing is displayed. Which is weird because if i create a link directly to maincon_contact and dont try to format the result in divs etc, then i get the result i want printed onto the screen. So its just when i try to display it within a div etc it dosent display anything. Any ideas? Link to comment https://forums.phpfreaks.com/topic/112340-problem-displaying-php-content/ Share on other sites More sharing options...
miracle_potential Posted June 28, 2008 Share Posted June 28, 2008 change all your includes to this format include("maincon_contact.php"); Not sure if I understood what you were asking but that was what I saw immedietly wrong Link to comment https://forums.phpfreaks.com/topic/112340-problem-displaying-php-content/#findComment-576749 Share on other sites More sharing options...
miracle_potential Posted June 28, 2008 Share Posted June 28, 2008 Ah I understand now try while($row = mysql_fetch_array($result)) { echo "Name: {$row['cname']} " . "Email: </strong></td><td>" . $row['cemail']; } Not sure why you have the end of table rows and stuff but hey Link to comment https://forums.phpfreaks.com/topic/112340-problem-displaying-php-content/#findComment-576753 Share on other sites More sharing options...
turkman Posted June 28, 2008 Author Share Posted June 28, 2008 no that wasnt the problem the problem was i had 'include maincon_contact.php'; as opposed to include 'maincon_contact.php'; the ' was wrongly put before include. Thanks for the input Link to comment https://forums.phpfreaks.com/topic/112340-problem-displaying-php-content/#findComment-576758 Share on other sites More sharing options...
miracle_potential Posted June 28, 2008 Share Posted June 28, 2008 Cool so it all works? if so hit solved Have fun PHP'ing Link to comment https://forums.phpfreaks.com/topic/112340-problem-displaying-php-content/#findComment-576772 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.