What im trying to do now... is list a table. The table is full of Links and menu's.
This is how im trying to have it outputted.
Navigation minRank: 0
Home minRank: 0
Members minRank: 0
Console minRank: 1
Forums minRank: 0
Downloads minRank: 1
All minRank: 1
Images minRank: 1
Exe minRank: 2
Zip minRank: 1
This is the script as it is currently. This is also confusing the ***** outa me and i dont know why.
PHP Code:
$sql = "SELECT * FROM navigation_links WHERE menu_id = -1";
$result = mysql_query($sql) or die(mysql_error());
$menus = array();
while($row = mysql_fetch_array($result)) {
$menus[] = $row;
}
//Tryed this to see if it'd work.
foreach($menus as $menu){
$sql1 = "SELECT * FROM navigation_links WHERE menu_id = '".$menu['link_id']."'";
$sql1 = "SELECT nav.*, nav2.* FROM navigation_links nav JOIN navigation_links nav2 ON nav2.menu_id = nav.link_id";
Check That...maybe NOt.
Last edited by PlaGuE; Jun 8th, 2006 at 10:12 PM.
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.
hmmm.... Well It works now... but i have another problem.
I need to be able to disable/enable the links.... I was thinking of using a checkbox. Where checked would be disabled. And enabled would be unchecked.... But the problem with this is... if its already enabled... it will be disabled. And Vise Versa.
Or a radio button system...But the snag there was... I click 1 radio button for enabled on 1 link.... and thats it... only does it for 1 link.
This is the code i use now.
PHP Code:
<?php
function disabled_menus_links(){
if(isset($_POST['update_submit'])){
if(is_array($_POST['navigation'])){
foreach($_POST['navigation'] as $id){
echo $id;
$query = mysql_query( "SELECT * FROM navigation_links WHERE link_id = $id" );
while ( $row = mysql_fetch_array( $query ) ) {
if ( $row['disabled'] == 0 ) {
mysql_query( "UPDATE navigation_links SET disabled = 1 WHERE link_id = $id" );
echo'Disabled';
echo $id . ' == ' . $row['link_id'];
}
if ( $row['disabled'] == 1 ) {
mysql_query( "UPDATE navigation_links SET disabled = 0 WHERE link_id = $id" );
echo'Undisabled';
echo $id . ' == ' . $row['link_id'];
}
}
}
}
}else{
$sql = 'SELECT * FROM navigation_links WHERE menu_id= -1';
$result = mysql_query( $sql ) or die( mysql_error() );
$menus = array();
while ( $row = mysql_fetch_array( $result ) ) {
$menus[] = $row;
}
$sql1 = "SELECT nav.*, nav2.* FROM navigation_links nav JOIN navigation_links nav2 ON nav2.menu_id = nav.link_id";
$result = mysql_query( $sql1 ) or die( mysql_error() );
<td colspan="2"><div align="center"><font size="5">Disable/Enable Links or Menus </font></div></td>
';
echo'</tr>
<tr id="TRHEADER">
<td colspan="2">When you click to disable a "menu", ALL links to that menu should be selected for disablement.Same goes for enabling a "menu".<br />
</td>
</tr>
<tr id="TRHEADER">
<td width="85%"><div align="left">Menu/Link Name </div></td>
Last edited by PlaGuE; Jun 10th, 2006 at 04:24 AM.
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.
Also, don't use echo() to output HTML. Output is what PHP does anyway. Just close the php tags ?>.
Now, I'm not fully understanding your second problem. When something's enabled, something's disabled... what? can you draw a bad picture of how you want it in Paint or something?
Also, don't use echo() to output HTML. Output is what PHP does anyway. Just close the php tags ?>.
Now, I'm not fully understanding your second problem. When something's enabled, something's disabled... what? can you draw a bad picture of how you want it in Paint or something?
Thats PHPEdits Code Beautifier for you.
Also i dont care about what the inside looks like right now. I'll be going thru it and fixing things up when i finish the few problems im still having...
Not to mention...That no one will be seeing the inside of the script anyways.Or so we are hoping. Im also slowly learning to indent properly.
My Second Problem is like this.
This problem is occuring in the "$_POST['update_submit'] IF Statement" at the top
PHP Code:
if(is_array($_POST['navigation'])){
foreach($_POST['navigation'] as $id){
echo $id;
$query = mysql_query( "SELECT * FROM navigation_links WHERE link_id = $id" );
while ( $row = mysql_fetch_array( $query ) ) {
if ( $row['disabled'] == 0 ) {
mysql_query( "UPDATE navigation_links SET disabled = 1 WHERE link_id = $id" );
echo'Disabled';
echo $id . ' == ' . $row['link_id'];
}
if ( $row['disabled'] == 1 ) {
mysql_query( "UPDATE navigation_links SET disabled = 0 WHERE link_id = $id" );
echo'Undisabled';
echo $id . ' == ' . $row['link_id'];
}
}
}
}
Like the image states.If i disable a link.An enabled Link will be disabled..But not all the time...Sometimes in order for the link to enable.Sumtin must be disabled....
Im trying to find a solution.That in the end.Will allow me to enable and disable links.One at a time.And it needs to know whether im disabling or enabling a link or many links.
Like i said...This is confusing.
Last edited by PlaGuE; Jun 10th, 2006 at 04:25 AM.
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.
There's gotta be a solution...
Fixed up Code.However I still will be echo'ing the HTML.For Now.
Pointless...this way seems...yet i've seen it done.Cant Remember where...tho.
I'll try a different way...for now.
What would be my best solution to doing what im trying to do? Instead of using checkbox's what else could i do....
Idk why but... i cant seem to think.
Last edited by PlaGuE; Jun 10th, 2006 at 12:36 PM.
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.