I have a problem whereby I need to show links based on an ID which is in
a MySQL DB.
So if ID 1 exists I pull an array of links which are defined as
belonging to ID1. This works OK.
How though can I distinguish between ID's which are not in the DB. I
want to display something if there are no links also and don't know what
I'm doing wrong. I try to display table 1 listed below but just get
nothing returned with this command.
What am I doing wrong?

print "<td valign='top' align='right'><img
src='pictures/document_heading_blue.gif' border='0'>";
// link to documents
$link_sql = "select * from documents 
        where id = '$id'";
$link_result = mysql_query($link_sql);
while ($documents = mysql_fetch_array($link_result)) 
                {
                        if (!$documents["id"])
//If no ID in DB display table 1...
                        {
                        print "<table cellpadding='4'><tr><td
width='10'><img src='../images/nuoli_right_pieni.gif'
border='0'></td><td width='166'><a
href='mailto:[EMAIL PROTECTED]'>No supporting documents with this
article mail us for more information</a></td></tr></table>";
                        }
                        else
//Display table with array of linked files.
                        {
                        print "<table cellpadding='4'><tr><td
width='40'><img src='../images/adobepdf.gif' border='0'></td><td
width='136'><a href='$documents[url]'
class='greenlinks'>$documents[name]</a></td></tr></table>";
                        }
                }

// end check for documents

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159


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

Reply via email to