I have a searchpage, which works fine. Search results are displayed in a table with tr hover and a window.location to take the user to a different page.

What I am trying to achieve is a dynamic link for the window.location based on data from the array. All the data in the db belongs to 4 different categories, *testkat*, and I would like to direct the user to the right page depending on the value from testkat, and then using the 'testid' to fill in the data.

I have been trying numerous ways to achieve my goal, and searched both SE, Google etc, but no luck. I'm pretty new to PHP so using the right search term might have something to do with it. 

From my point of view I'm thinking that I have to store the value from *testkat* in a variable, lets say $link. And from there make an IF statement, something like: 

```
if ($results('testkat') == 'something') {
$link = "something.php?id='$testid'";
}

if ($results('testkat') == 'something_else') {
$link = "something_else.php?id='$testid'";
}

```

* And from there put $link in the window.location

Here's my code:

```
<?php
$conn = mysql_connect("localhost", "root", "") or die("Couldn't do it: ".mysql_error());
mysql_select_db("db") or die(mysql_error());
mysql_set_charset('utf8',$conn); 

$query = $_POST['query'];  
$query = htmlspecialchars($query); 
$query = mysql_real_escape_string($query);

$raw_results = mysql_query("SELECT * FROM db WHERE (`id` LIKE '%".$query."%') OR (`name` LIKE '%".$query."%') OR (`age` LIKE '%".$query."%')") or die(mysql_error());
$count = mysql_num_rows($raw_results);

if(isset($_POST['query'])) {

    echo "<br>";
    echo "Your search for <span class=\"bold\">" .$query. "</span> returned " . $count . " hits";
    echo "<br>";

if(mysql_num_rows($raw_results) > 0){ 

        echo "<br>";
        echo "<table class=\"tbl-text\">";
        echo "<tr class=\"tablelist\"><th>Heading 1</th><th>Heading 2</th><th>#</th><th>Heading 3</th><th>Heading 4</th><th>Heading 5</th>";

    while($results = mysql_fetch_array($raw_results)){

        echo "<tr onclick=\"window.location='#'\" style=\"cursor:pointer\" class=\"tr-hover\">";
        echo "<td class=\"bordered\">" .$results['testid'] . "</td>";
        echo "<td class=\"bordered\">" .$results['testkat'] . "</td>";
        echo "<td class=\"bordered\">" .$results['intnr'] . "</td>";
        echo "<td class=\"bordered\">" .$results['pro'] . "</td>";

    }
        echo "</table>";
    }

    else{ 

    }
    }
    ?>

```

Update:
Forgot to tell about the error. When doing it the way I think it should be done, I get an error message in the IF statement saying: Fatal error: Function name must be a string. 

Referring to this one:

```
if ($results('testkat') == 'something') {
$link = "something.php?id='$testid'";
}

```

I know about MySQLi and PDO, working on it.
Eager to learn, so any hints and tricks are greatly appreciated :)

Chris