/    Sign up×
Community /Pin to ProfileBookmark

Pulling individual ‘page names’ from a table for use in navigation

Hey all, I’ve created a back end where customers can edit their content. The page content (just text) is currently in a table, which includes the meta tags and page name. I have been using the following code to get the specific content on each page using WHERE id = 1,2,3 etc

[code=php]
mysql_select_db($database_template, $template);
$query_pages = “SELECT * FROM pages WHERE id = 1”;
$pages = mysql_query($query_pages, $template) or die(mysql_error());
$row_pages = mysql_fetch_assoc($pages);
$totalRows_pages = mysql_num_rows($pages);
[/code]

I now want to pull the page name from individual records so I can insert it into the navigation buttons. This way, if they change the page name from the back end, it will be reflected in the navigation buttons on every page. I don’t want to use a while loop in the nav as some of the buttons are unique, like the active one has different properties and an arrow. What is the best way to pull individual bits of information from a table, so <?php echo $row_pages[‘pagename’]; ?> where ID = 2. <?php echo $row_pages[‘pagename’]; ?> where ID = 3 etc. I could duplicate the above 10 times on each page purely to get the page name but I guess there’s a better way? Thanks in advance ?

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @drennan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...