Hi.
I got this working (almost)
How do I decide (inside?) the whileloop the table_nr, 1 to 4 witch the link is 
echo'ed from.

I could add another field in each table telling witch table it is. Easy 
solution, but feels like polluting the db.

Also I could do another loop to check another of the printed fields up agains 
witch table is used, but that adding to the slowness of this union stuff, it 
would take forever, if the union in itself is slow or the fact that I'm 
cutting the message field after 100 characters I dunno.

This is anyway the main code wherein the problem lies:

$sql="  (select * from table_1 WHERE pid='0' order by id desc limit 10) union 
                (select * from table_2 WHERE pid='0' order by id desc limit 10) 
union 
                (select * from table_3 WHERE pid='0' order by id desc limit 10) 
union 
                (select * from table_4 WHERE pid='0' order by id desc limit 10) 
                order by date desc limit 10     ";

$result = mysql_query($sql) or die('Error, query failed');
while($myrow = mysql_fetch_array($result)){
        $id = $myrow["id"];
        $pid = $myrow["pid"];

        echo "<a href=\"index.php?table=$table_nr">page</a>";
}

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to