skylab Posted August 26, 2013 Share Posted August 26, 2013 (edited) I'm trying to add an include inside regular text. I don't know why it doesn't work. It's ignoring the in_header.php even though I escaped the ' with a \ Any help would be greatly appreciated. <?php //MySQL Database Connect include 'bind.php'; $sql = mysql_query("SELECT * FROM sql_test WHERE Name= 'TEST'"); while($result = mysql_fetch_array($sql)) { echo $result["Name"]. $result["Gender"]. 'TEXT TEXT TEXT <?php include \'inc_header.php\'?> Text Text Text'; } ?> Edited August 26, 2013 by skylab Quote Link to comment Share on other sites More sharing options...
ryanmetzler3 Posted August 26, 2013 Share Posted August 26, 2013 try this instead require ('bind.php'); Quote Link to comment Share on other sites More sharing options...
skylab Posted August 26, 2013 Author Share Posted August 26, 2013 The problem is not with 'bind.php' that one works and I'm able to connect to sql and retrieve Name and Gender. But the <?php include 'inc_header.php'?> is the file which is ignored. I tried your advice but it didn't work. Quote Link to comment Share on other sites More sharing options...
trq Posted August 26, 2013 Share Posted August 26, 2013 Your already within php tags, you don't need more. Also, includes don't need to be echoed. echo $result["Name"] . $result["Gender"] . 'TEXT TEXT TEXT'; include 'inc_header.php'; echo 'Text Text Text'; Quote Link to comment Share on other sites More sharing options...
skylab Posted August 26, 2013 Author Share Posted August 26, 2013 That did it thanks a lot. That will save me a lot time and effort. Have a great week. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.