print is a function - you need to enclose anything you want to output using it with brackets. In this scenario anyway you want to use echo. The fixed code below also includes some changes from the original to speed up the script (and a few bug fixes) that are detailed below.
PHP Code:
<?php
mysql_select_db($db_name);
$linkovi = mysql_query('SELECT `title`, `link`, `tooltip` FROM `pages` WHERE `position` = 1 ORDER BY `orderby` ASC') or die (mysql_error());
while ($linkovi2=mysql_fetch_assoc($linkovi))
{
echo '<a href="'.$linkovi2['link'].'" title="" onmouseover="$WowheadPower.showTooltip(event, '.$linkovi2['tooltip'].')" onmousemove="$WowheadPower.moveTooltip(event)" onmouseout="$WowheadPower.hideTooltip();">'.$linkovi2['title'].'</a>';
}
?>
<!-- example toolip link for regular html -->
<a href="./quest.php?name=shoutbox" onmouseover="$WowheadPower.showTooltip(event, 'Chat with other b3ckswow users Live!')" onmousemove="$WowheadPower.moveTooltip(event)" onmouseout="$WowheadPower.hideTooltip();">Shoutbox</a>
Also, a few tips:
In an SQL Statement, you don't need to enclose integers in quotes.
Code:
SELECT title,link,tooltip FROM pages WHERE position = '1' ORDER BY orderby ASC
Would be better written as:
Code:
SELECT `title`, `link`, `tooltip` FROM `pages` WHERE `position` = 1 ORDER BY `orderby` ASC
I've also enclosed table and field names in ` characters. You can insert these by pressing the key just below the ESC key on your keyboard, and whilst not strictly necessary they help to make your code easier to read.
There is no need to put the SQL Statement in double quotes, single will do in this case.
PHP Code:
$linkovi = mysql_query("SELECT title,link,tooltip FROM pages WHERE position = '1' ORDER BY orderby ASC") or die (mysql_error());
Would be better written as:
PHP Code:
$linkovi = mysql_query('SELECT `title`, `link`, `tooltip` FROM `pages` WHERE `position` = 1 ORDER BY `orderby` ASC') or die (mysql_error());
There's no point to using double quotes unless you wish to embed variables directly into the string.
As you're not doing this, you should use single quotes - it's (slightly) faster. If you do want to put variables into the statement, insert them as you do in the echo statement - that is, like ' . $variable . ' - which provides a speed boost over using double quotes to insert variables into the string.
When putting variables into the sql though, make sure to use
mysql_real_escape_string() to prevent any malicious users making your query do something unexpected (search google for 'sql injection php' or similar for more information on this).
Finally, make sure you check that mysql_select_db() doesn't produce an error. I assume you've used mysql_connect() prior to including this file, otherwise it *probably* won't work.