Jump to content

Links menu

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
IIMarckus

IIMarckus

    Newbie

  • Members
  • Pip
  • 5 posts
Hey guys,

My goal is to have this output:
<div> - <a href="index.php">Index</a> - <a href="about.php">About</a> - <a href="etc.php">Etc</a> -</div>
Here's my table:
name  priority  url  english

main  1         index Home

about 2         about About

more  3         etc  Etc
Here's my code:
//displays the links at the top of the page

function pagemenu($language){

$query = mysql_query("SELECT * FROM lang_text_pagenames ORDER BY priority") or die(mysql_error());


echo("<div> -");

while($menuitem = mysql_fetch_array($query)) {

echo(" <a href=\"".$root_dir.$menuitem['url'].".php\">".$menuitem[$language]."</a> -");}

echo("</div>");

}
$root_dir is just './'; $language is e.g. 'English'. And here's what I get:
<div> - <a href="index.php"></a> - <a href="about.php"></a> - <a href="etc.php"></a> -</div>
What am I doing wrong?

#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Well in the example above $language is 'english' not 'English' - not sure if thats a typo, but that will make a difference.

#3
IIMarckus

IIMarckus

    Newbie

  • Members
  • Pip
  • 5 posts

Sidewinder said:

Well in the example above $language is 'english' not 'English' - not sure if thats a typo, but that will make a difference.
Although I'm quite sure that I named the column 'English', but it is indeed in all lowercase now. Does PHP have a tolower() function or equivalent that I could use?

EDIT: strtolower() is what I'm looking for. Thanks.

#4
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Did that fix the problem, or should I look for something else?

#5
IIMarckus

IIMarckus

    Newbie

  • Members
  • Pip
  • 5 posts
Yeah, that fixed it. Thanks for reminding me about case sensitivity, though; that can be pretty hard to see.