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
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?

 

Link to comment
Share on other sites

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>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.