tags:

views:

45

answers:

2

Hello.

So i have this script:

<?php 
$query = mysql_query("
SELECT meetup AS text, id AS theID, dato FROM member_meetups WHERE username = '$pusername' UNION
SELECT navn AS text, id AS theID, dato FROM member_film WHERE username = '$pusername' UNION
SELECT title AS text, id AS theID, dato FROM member_tutorials WHERE username = '$pusername'
ORDER BY dato DESC
LIMIT 5;
");
while ($row = mysql_fetch_assoc($query)) { echo $row['theID'].' - '. $row['text'] . ' - ' . $row['dato']."<br>"; }
?> 

which is showing data from the 3 queries with $row['text'], and then the id as $row['theID']

Now, i have ran into an issue, because i want to make links.. First i thought i could do this:

<a href='show.php?id=<? echo $row['theID']; ?>'><? echo $row['text'] . ' - ' . $row['dato']."</a><br>";

But i cant in my situation, because i have member_meetups show.php at meetups/show.php, and tutorials at tutorial/show.php and film at film/show.php..

So if i link it as e.g film/show.php?id=$row['id'] , it wont go to the right link if you press on $row['text'] there is from member_tutorial..

How should i solve this?

A: 

Add a / or the full URL to your site at the front of it to make it an absolute path such as:

/film/show.php?id=$row['id']

or

http://www.example.com/film/show.php?id=$row['id']
animuson
Read the question again ;)
Bart van Heukelom
A: 

Add another field and use it in the link:

SELECT "meetup" AS type, meetup AS text, id AS theID, dato FROM member_meetups ...

  ....

echo '<a href="/'.$row['type'].'/show.php?id='.$row['theID'].'">'...
Ignacio Vazquez-Abrams