Jump to content

Help including a navigation


spacepoet

Recommended Posts

Hello:

 

I wanted to see if someone can help me figure out how to include data from my included navigation file.

 

Meaning:

 

I have this file called myNav.php (the database table storing this is "myUpcomingEvents"):

function spLeftMenu() {
$spLeftMenu =
"

<div id=\"sideEvents\">
echo \" $mySideBarData; \";
</div>

";
return $spLeftMenu;
}

 

I am trying to pull it into the Index.php page like this (the database table storing this is "myHome"):

<?php
include('include/myConn.php');
include('include/myNav.php');

$query=mysql_query("SELECT * FROM myHome,myUpcomingEvents") or die("Could not get data from db: ".mysql_error());
while($result=mysql_fetch_array($query))
{

  $myPageData=$result['myPageData'];
  
  $mySideBarPageData=$result['mySideBarPageData'];
}

?>

<!DOCTYPE HTML>

<html>

<head></head>

<body>

<div id="siteContainer">


<div id="leftColumn">
	<?php echo spLeftMenu(); ?>				
</div>

<div id="mainContent">
	<?php echo $myPageData; ?>
</div>


</div>

</body>

</html>

 

Can't get it to work. It just writes out:

echo " ; "; 

 

Anyone know how I can get this to work?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/251226-help-including-a-navigation/
Share on other sites

Hi:

 

Thanks for the reply, but it did not work.

Speaking of variables, see something missing?

Not sure what you mean ... what did I miss?

 

The:

<?php echo spLeftMenu(); ?>

 

Works fine as far as displaying the DIVs/layout/Design on the "Index.php" page:

<div id=\"sideEvents\">
echo \" $mySideBarData; \";
</div>

I just can't get the data from the database (mySideBarData) to display.

 

Any other ideas?

 

Hey sorry about earlier post.  Didn't see the function spLeftMenu at the top and assumed it should have been a variable.

What you posted here is a little confusing as you are escaping your quotes on the <div id=\"sideEvents\"> and then in correctly for the echo line.

<div id=\"sideEvents\">

echo \" $mySideBarData; \";

</div>

It should be either

echo "<div id=\"sideEvents\">$mySideBarData</div>";

OR

<div id="sideEvents">
echo "$mySideBarData";
</div>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.