Maybe this will give you some idea of how to do it:
<?php
$menu = array(
'Home' => 'index.php',
'About' => 'about.php',
'Contact' => 'contact.php'
);
foreach ($menu as $name => $link) {
echo '<li><a href="' . $link . '" target="_self">' . $name . '</a></li>'.PHP_EOL;
}
?>
Use mysql_fetch_assoc instead (it's the same thing as "mysql_fetch_array($result, MYSQL_ASSOC)"). Like this:
while ($row = mysql_fetch_assoc($result)) {
echo '<li><a href="' . $row['linklocation'] . '" target="_self">' . $row['linkname'] . '</a></li>'.PHP_EOL;
}
If you're inserting the menu into the db for good, I think it's no use to check if there are any "num_rows". So I think you can skip the "if(mysql_num_rows($result) > 0)" statement (and its curly brackets).
Also, I don't think it's a good idea to die with a mysql_error string. You don't want your visitors to accidentally read one of these on your site, do you? I don't know the best practice here, but I'd be using mysql_errno:
$result = mysql_query($query) or die("DB error: #" . mysql_errno());
// or just output an error string:
$result = mysql_query($query) or die("Could not query database");