You are here: Re: how to clear an array « All PHP « IT news, forums, messages
Re: how to clear an array

Posted by Sentinel on 10/13/93 11:28

JDS 04.10.2005 16:06:36
<pan.2005.10.04.14.06.36.960080@example.invalid>
jeffrey@example.invalid alt.php JDS

php code

<?php
$r_menuheader = mysql_query("SELECT * FROM `menu_headers` ORDER BY
`header_order`");
while ($row_menuheader =
mysql_fetch_array($r_menuheader,MYSQL_ASSOC)){
print "<table cellpadding=0 cellspacing=0 width=100%
style=\"border-bottom: 1px #000000 solid\">";
print "<tr><td valign=top bgcolor=#000000><table cellspacing=0
cellpadding=0 width=100%><tr><td width=125>";
print "<a href=\"javascript:confirmation('Mjenjati
Opciju?','menu.edit.php?aut=".$_GET['aut']."&hid=".$row_menuheader{'head
er_id'}."')\"><img src=\"../images/edit.gif\" border=\"0\" /></a>";
print "<a href=\"javascript:confirmation('Brisati
Opciju?','menu.delete.php?aut=".$_GET['aut']."&hid=".$row_menuheader{'he
ader_id'}."')\"><img src=\"../images/delete.gif\" border=\"0\"
onclick=\"confirmdelete(\"Delete News?\")\" /></a>";
if ($row_menuheader{'header_order'}<>"1") {print "<a
href=\"process.menu.up.php?aut=".$_GET['aut']."&hid=".$row_menuheader{'h
eader_id'}."\"><img src=\"../images/up.gif\" border=\"0\" /></a>";}
print "<a
href=\"process.menu.down.php?aut=".$_GET['aut']."&hid=".$row_menuheader{
'header_id'}."\"><img src=\"../images/down.gif\" border=\"0\" /></a>";
print "</td><td><span class=th><center>..::
".$row_menuheader{'header_name'}."
::..</center></span></td></tr></table></td></tr>";
unset($row_menuitems);
$r_menuheaderitm = mysql_query("SELECT* FROM `menu_headers_items`
where `header_id`='".$row_menuheader{'header_id'}."' ORDER BY
`item_order`");
while ($row_menuitems =
mysql_fetch_array($r_menuheaderitm,MYSQL_ASSOC)){
print "<tr><td valign=top><table cellspacing=0 cellpadding=0
width=100%><tr><td width=125>";
print "<a href=\"javascript:confirmation('Mjenjati
Opciju?','menuitem.edit.php?aut=".$_GET['aut']."&mid=".$row_menuitems{'i
tem_id'}."')\"><img src=\"../images/edit.gif\" border=\"0\" /></a>";
print "<a href=\"javascript:confirmation('Brisati
Opciju?','menuitem.delete.php?aut=".$_GET['aut']."&mid=".$row_menuitems{
'item_id'}."')\"><img src=\"../images/delete.gif\" border=\"0\"
onclick=\"confirmdelete(\"Delete News?\")\" /></a>";
if ($row_menuitems{'reqreg'}=="1") {print "<a
href=\"process.menuitem.unregister.php?aut=".$_GET['aut']."&mid=".$row_m
enuitems{'item_id'}."\"><img src=\"../images/u.gif\" border=\"0\"
/></a>";}
else {print "<a
href=\"process.menuitem.register.php?aut=".$_GET['aut']."&mid=".$row_men
uitems{'item_id'}."\"><img src=\"../images/r.gif\" border=\"0\"
/></a>";}
if ($row_menuitems{'item_order'}<>"1") {print "<a
href=\"process.menuitem.up.php?aut=".$_GET['aut']."&mid=".$row_menuitems
{'item_id'}."&hid=".$row_menuheader{'header_id'}."\"><img
src=\"../images/up.gif\" border=\"0\" /></a>";}
print "<a
href=\"process.menuitem.down.php?aut=".$_GET['aut']."&mid=".$row_menuite
ms{'item_id'}."&hid=".$row_menuheader{'header_id'}."\"><img
src=\"../images/down.gif\" border=\"0\" /></a>";
print "</td><td>..::<a
href=\"".$row_menuitems{'item_link'}."?aut=".$_GET['aut']."\">".$row_men
uitems{'item_name'}."</a></td></tr></table>";
print "</td></tr>";
}
print "<tr><td>";
print "<a href=\"javascript:confirmation('Dodati
Opciju?','menuitem.add.php?aut=".$_GET['aut']."&hid=".$row_menuheader{'h
eader_id'}."')\"><img src=\"../images/add.gif\" border=\"0\" /></a>";
print "</td></tr>";
print "</table>";
print "<table height=4><tr><td></td></tr></table>";
}
print "<table cellpadding=0 cellspacing=0 width=100%
style=\"border-bottom: 1px #000000 solid\">";
print "<tr><td valign=top bgcolor=#000000><table cellspacing=0
cellpadding=0 width=100%><tr><td width=50>";
print "<a href=\"javascript:confirmation('Dodati
Opciju?','menu.add.php?aut=".$_GET['aut']."')\"><img
src=\"../images/add.gif\" border=\"0\" /></a>";
print "</td><td><span
class=th><center>&nbsp;</center></span></td></tr></table></td></tr>";
print "</table>";
?>



now. there are two loops
one that cycles thru menu headers
and one that looks thru menu items
next to every menu header and menu item i have two buttons - move up
and move down
the first item (of each) should have move down button only
the last item (of each) should have move up button only
the first item is easy- item with roworder of 1
but since i don't know how many items there are: how do i findout when
the array is at the last row?

thanks
--
Will work for bandwidth!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация