Re: [PHP] build menu with mysql data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Eddie,

This is exactly what I'm looking for. I don't have some code today that's
why I'm posting to the newsgroup. The only working thing I have today is the
listing of the "main db"
It looks a bit whired since I copy past it from the file.
Could you post some of your code?

----------------------------------------------------------------------------
-------------------------------------------------
print "$html_body_in";
   print "<b>Systems</b><br><br>";
   print "<table border=\"0\" width=\"900\" cellspacing=\"0\"
cellpadding=\"0\" style=\"font-size: 10pt\">";
      print "<tr>";
         print "<td width=\"20\"><b></b></td>";
            print "<td width=\"130\"><b>Name</b></a></td>";
            print "<td width=\"130\"><b>Vendor</b></td>";
   print "<td width=\"620\"><b>Description</b><b></td>";
         print "\t</tr>\n";
   print "</table>\n";

   $query="SELECT system.*, vendor.* FROM system, vendor where system.VENDOR
= vendor.ID order by system.NAME ASC";
   $result=mysql_query($query);
   $num=mysql_numrows($result);

   $i=0;

   while ($i < $num) {
   $system_id=mysql_result($result,$i,"system.ID");
   $system_name=mysql_result($result,$i,"system.NAME");
   $vendor_name=mysql_result($result,$i,"vendor.NAME");
   $vendor_id=mysql_result($result,$i,"vendor.ID");
   $system_description=mysql_result($result,$i,"system.DESCRIPTION");


       print "<table border=\"0\" width=\"900\" cellspacing=\"0\"
cellpadding=\"0\" style=\"font-size: 10pt\">";
        print "<tr>";
      print "<td width=\"20\"><a
href=\"index.php?$LINK&ACTION=system&SUB=systemdetail&sysid=$system_id\"><im
g border=\"0\" src=\"$plus_gif\" alt=\"extract $system_name\"></a></td>";
   print "<td width=\"130\"><a
href=\"index.php?$LINK&ACTION=system&SUB=systemdetail&sysid=$system_id\">$sy
stem_name</a></td>";
            print "<td width=\"130\"><a
href=\"index.php?$LINK&ACTION=system&SUB=vendordetail&vendorid=$vendor_id\">
$vendor_name</a></td>";
   print "<td width=\"520\">$system_description</td>";
            print "<td width=\"25\"><a
href=\"index.php?$LINK&ACTION=system&SUB=systemdetail&sysid=$system_id\"><im
g border=\"0\" src=\"$edit_gif\" alt=\"edit $system_name\" width=\"12\"
height=\"12\"></a></td>";
   print "<td width=\"25\"><a
href=\"index.php?$LINK&ACTION=admin&SUB=useradd\"><img border=\"0\"
src=\"$new_gif\" alt=\"add Useraccount\" width=\"12\"
height=\"12\"></a></td>";
            print "<td width=\"50\"><a
href=\"index.php?$LINK&ACTION=system&SUB=systemdetail&sysid=$system_id\"><im
g border=\"0\" src=\"$delete_gif\" alt=\"delete $system_name\" width=\"12\"
height=\"12\"></a></td>";

   print "</tr>";
      print "</table>";

   ++$i;
   }

----------------------------------------------------------------------------
-------------------------------------------------

br Marc


   print "$html_body_out";
"Edward Peloke" <epeloke@echoman.com> schrieb im Newsbeitrag
NFBBIIKNALMFFNANEKEFCEIJDEAA.epeloke@echoman.com">news:NFBBIIKNALMFFNANEKEFCEIJDEAA.epeloke@echoman.com...
> Marc,
>
> I did something sort of along these lines with an 'auction' site I worked
> on.  I displayed rows from a db.  If the row had bid information in the db
> (or your case submenu info) then a + sign icon was displayed next to it.
IF
> the plus sign was clicked, the page would reload and the bid or submenu
info
> would be displayed and the + sign would change to a - sign to give the
> appearence of a tree menu.   Can you post some of your code?
>
> Eddie
>
> -----Original Message-----
> From: Marc Bleuler [mailto:marc@bleuler.net]
> Sent: Tuesday, January 21, 2003 12:31 PM
> To: php-db@lists.php.net; php-general@lists.php.net
> Subject: [PHP] build menu with mysql data
>
>
> Hi,
>
> I would like to bild a tree menu with mySQL data. where I have the
collapsed
> main menue and when I click the link the specific submenue expands (as
> follow).
>
> (collapsed Main Menu)
> + Home
> + Downloads
> + About me
> + Search
>
> ....and for example if I click the "Download" section it will look as
> follow....
>
> (expanded Main-Sub Menu)
> + Home
> + Downloads
>     - Music
>     - Programm
> + About me
> + Search
>
> ....and the SQL Tables...
>
> MAINMENUE_TABLE
>     ID        NAME
> -----------------------------
> |    1    |    Home                |
> |    2    |    Downloads        |
> |    3    |    About me          |
> |    4    |    Search               |
>
> ....and....
>
> SUBMENUE_TABLE
>     ID        MAIN_ID      NAME            URL
> -------------------------------------------------------------------
> |    1    |    2                |    Music            |
> ./somefile.php?action=music
> |    2    |    2                |    Programm     |
> ./somefile.php?action=programm
> |    3    |    3                |    Pictures         |
> ./somefile.php?action=pictures
> |    4    |    3                |    Address        |
> ./somefile.php?action=address
> |    5    |    4                |    My Page       |
> ./somefile.php?action=mypage
> |    6    |    4                |    The Web       |
> ./somefile.php?action=theweb
> |    7    |    4                |    Google          |
> ./somefile.php?action=google
>
>
> If I'm using a while loop it won't work, so I realy don't have and more
> ideas...
> Please consider in your explanations I'm a PHP beginner... :-)
>
> thanks
> Marc
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux