Marc,
Here is the entire script...
It is doing a lot of things you don't need so you will have to sift through
it to see what you want. If you have any questions, just ask.
Eddie
<?
require("connection.php");
if ($addbid) {
# setup SQL statement
$SQL = " INSERT INTO bids";
$SQL = $SQL . " (clientreqid,amount,operatorid,accepted) Values";
$SQL = $SQL . " ('$clientreqid','$amount','$operatorid',0) ";
#execute SQL statement
$result = mysql_db_query($db,"$SQL",$connection);
}
# setup SQL statement
$SQL = "select id,clientid,DATE_FORMAT(departdate, '%m/%d/%y') as
departdate,DATE_FORMAT(returndate, '%m/%d/%y') as
returndate,departloc,numpass,craftpref,returnloc from clientreq";
#execute SQL statement
$result = mysql_db_query($db,"$SQL",$connection);
$bgcolor="#fffafo";
##get the lengths
$sqllength="select max(length(departloc)) as departloclen,
max(length(departdest)) as departdestlen from clientreq"
?>
<br> <br>
<table width="95%" border="0">
<tr bgcolor="#2c1d65" border="1">
<td> </td>
<td><font face="arial" size="4" color="#fffaf0"><b>Depart</td>
<td><font face="arial" size="4" color="#fffaf0"><b>Location</td>
<td><font face="arial" size="4" color="#fffaf0"><b># Pass</td>
<td><font face="arial" size="4" color="#fffaf0"><b>Return</td>
<td><font face="arial" size="4" color="#fffaf0"><b>Return</td>
<td><font face="arial" size="4" color="#fffaf0"><b>Location</td>
<td><font face="arial" size="4" color="#fffaf0"><b>Craft Preference</td>
<td><font face="arial" size="4" color="#fffaf0"><b>Lowest Bid</td>
<td><font face="arial" size="3" color="#fffaf0"><b>Add Bid</td>
</tr>
<? $trcolor="#F0F8FF";
while ($myrow = mysql_fetch_array($result)){
$return='No';
$colorset=0;
if ($myrow["return"]==1){
$return='Yes';}
$open='No';
if ($myrow["open"]==1){
$open='Yes';}
if ($trcolor=='#F0F8FF'){
$trcolor='#B0C4DE';
$colorset=1;
}
if ($colorset==0){
if ($trcolor=='#B0C4DE'){
$trcolor='#F0F8FF';}
}
if ($bidhist<>1){
# setup SQL statement
$SQL3 = "select min(amount), count(*) as count1 from bids where
clientreqid=".$myrow["id"]."";
#execute SQL statement
$result3= mysql_db_query($db,"$SQL3",$connection);
$myrow3=mysql_fetch_array($result3);
$count1=$myrow3["count1"];
print "<tr bgcolor='$trcolor'>";
if ($count1>0){
print"<td><a
href='auction3.php?clientreqid=".$myrow["id"]."&bidhist=1'><img
name='bidhist' src='plus.gif' border='0'></a></td>";
$minbid=$myrow3["min(amount)"];
}
if ($count1==0){
print"<td></td>";
$minbid="No Bids";
}
print"<td>".$myrow["departdate"]."</td>";
print"<td>".$myrow["departloc"]."</td>";
print"<td>".$myrow["numpass"]."</td>";
print"<td>$return</td>";
print"<td>".$myrow["returndate"]."</td>";
print"<td></td>";
print"<td>".$myrow["craftpref"]."</td>";
print"<td>$minbid</td>";
print "<td><nobr><a href='addbid.php?reqid=".$myrow["id"].
"&operatorid=$operatorid'>Add Bid</a></nobr></td></tr>";
}
if ($bidhist==1){
# setup SQL statement
$SQL3 = "select min(amount), count(*) as count1 from bids where
clientreqid=".$myrow["id"]."";
#execute SQL statement
$result3= mysql_db_query($db,"$SQL3",$connection);
# setup SQL statement
$SQL4 = "select b.amount, DATE_FORMAT(b.timestamp, '%m/%d/%y')
as timestamp, o.corpname from bids b ,operators o where b.operatorid=o.id
and clientreqid='$clientreqid' order by b.amount,b.timestamp asc";
#execute SQL statement
$result4= mysql_db_query($db,"$SQL4",$connection);
$myrow3=mysql_fetch_array($result3);
$count1=$myrow3["count1"];
if($clientreqid==$myrow["id"]){
print "<tr bgcolor='$trcolor'>";
if ($count1>0){
print"<td><a
href='auction3.php?clientreqid=".$myrow["id"]."&bidhist=0'><img
name='bidhist' src='minus.gif' border='0'></a></td>";
$minbid=$myrow3["min(amount)"];
}
if ($count1==0){
print"<td></td>";
$minbid="No Bids";
}
print"<td>".$myrow["departdate"]."</td>";
print"<td>".$myrow["departloc"]."</td>";
print"<td>".$myrow["numpass"]."</td>";
print"<td>$return</td>";
print"<td>".$myrow["returndate"]."</td>";
print"<td></td>";
print"<td>".$myrow["craftpref"]."</td>";
print"<td>$minbid</td>";
print "<td><nobr><a href='addbid.php?reqid=".$myrow["id"].
"&operatorid=$operatorid'>Add Bid</a></nobr></td></tr>";
print" <tr bgcolor='#2c1d65' border='1'>";
print"<td bgcolor=$bgcolor></td>";
print"<td bgcolor=$bgcolor></td>";
print"<td><font face='arial' size='2' color=$bgcolor><b>Bid
History</td>";
print" <td><font face='arial' size='2'
color=$bgcolor><b>Operator</td>";
print" <td><font face='arial' size='2'
color=$bgcolor><b>Bid</td>";
print" <td><font face='arial' size='2' color=$bgcolor><b>Bid
Date</td>";
print"<td bgcolor=$bgcolor></td>";
print"<td bgcolor=$bgcolor></td>";
print"<td bgcolor=$bgcolor></td>";
print "<td bgcolor=$bgcolor></td></tr>";
while ($myrow4 = mysql_fetch_array($result4)){
print "<tr bgcolor='$trcolor'>";
print"<td bgcolor=$bgcolor></td>";
print"<td bgcolor=$bgcolor></td>";
print"<td bgcolor=$bgcolor></td>";
print"<td>".$myrow4["corpname"]."</td>";
print"<td>".$myrow4["amount"]."</td>";
print"<td>".$myrow4["timestamp"]."</td>";
print"<td bgcolor=$bgcolor></td>";
print"<td bgcolor=$bgcolor></td>";
print"<td bgcolor=$bgcolor></td>";
print "<td bgcolor=$bgcolor></td></tr>";
}
}
if($clientreqid<>$myrow["id"]){
print "<tr bgcolor='$trcolor'>";
if ($count1>0){
print"<td><a
href='auction3.php?clientreqid=".$myrow["id"]."&bidhist=1'><img
name='bidhist' src='plus.gif' border='0'></a></td>";
$minbid=$myrow3["min(amount)"];
}
if ($count1==0){
print"<td></td>";
$minbid="No Bids";
}
print"<td>".$myrow["departdate"]."</td>";
print"<td>".$myrow["departloc"]."</td>";
print"<td>".$myrow["numpass"]."</td>";
print"<td>$return</td>";
print"<td>".$myrow["returndate"]."</td>";
print"<td></td>";
print"<td>".$myrow["craftpref"]."</td>";
print"<td>$minbid</td>";
print "<td><nobr><a href='addbid.php?reqid=".$myrow["id"].
"&operatorid=$operatorid'>Add Bid</a></nobr></td></tr>";
}
}
}
print"</table>";
?>
-----Original Message-----
From: Marc Bleuler [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 21, 2003 2:11 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] Re: [PHP] build menu with mysql data
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" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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:[EMAIL PROTECTED]]
> Sent: Tuesday, January 21, 2003 12:31 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> 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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php