We help IT Professionals succeed at work.
Get Started

Problem view links on the page

saul_roldan
saul_roldan asked
on
182 Views
Last Modified: 2013-12-12
I creat this tree menu in wich each link open a new page.

All menu shows fine but I cant make  this code: <?php echo $row_contenido['contenido']; ?> to show the content in the page.
<?php require_once('../Connections/menuArticulos.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
$colname_contenido = "-1";
if (isset($_GET['seccion_id'])) {
  $colname_contenido = $_GET['seccion_id'];
}
mysql_select_db($database_menuArticulos, $menuArticulos);
$query_contenido = sprintf("SELECT contenido FROM arti_submenu WHERE seccion_id = %s ORDER BY articulo_id ASC", GetSQLValueString($colname_contenido, "int"));
$contenido = mysql_query($query_contenido, $menuArticulos) or die(mysql_error());
$row_contenido = mysql_fetch_assoc($contenido);
$totalRows_contenido = mysql_num_rows($contenido);
 
 
 
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
</head>
 
<body>
<p>
  <!--Codigo del menu-->
  <?php mysql_select_db($database_menuArticulos, $menuArticulos);
$query_menu = "SELECT * FROM arti_menu WHERE seccion_id = seccion_id ORDER BY seccion_id ASC";
$menu = mysql_query($query_menu, $menuArticulos) or die(mysql_error());
$row_menu = mysql_fetch_assoc($menu);
//$totalRows_menu = mysql_num_rows($menu);?>
  <?php do { ?>
    <?php echo $row_menu['menu'] . '<br>'; ?>
    <!--Colocar despues de esta linea el Codigo del submenu-->
    <?php mysql_select_db($database_menuArticulos, $menuArticulos);
$query_submenu = "SELECT * FROM arti_submenu WHERE seccion_id = ".$row_menu['seccion_id']."";
$submenu = mysql_query($query_submenu);
$row_submenu = mysql_fetch_assoc($submenu);
//$totalRows_submenu = mysql_num_rows($submenu);?>
    <!--Codigo del submenu-->
    <?php do { ?>
      <a href="treeMenuDreamweaverCode.php?seccion_id=<?php echo $row_submenu['articulo_id']; ?>"><?php echo $row_submenu['titulo'].'<br>'; ?></a> 
      <?php } while ($row_submenu = mysql_fetch_assoc($submenu)); ?>
    <!--array del menu-->
    <?php } while ($row_menu = mysql_fetch_assoc($menu)); ?>
</p>
<h1>The content goes here</h1>
<p><?php echo $row_contenido['contenido']; ?>
</p>
</body>
  
</html>
<?php
mysql_free_result($menu);
 
mysql_free_result($submenu);
 
mysql_free_result($contenido);
?>

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Expert of the Year 2008
Top Expert 2008
Commented:
This problem has been solved!
Unlock 2 Answers and 32 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE