Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    rinominare un campo col nome inserito nel database

    ciao a tutti, c'e' qualcuno che ha voglia di aiutarmi a sistemare un inconveniente?
    dunque... sto cercando di realizzare un semplice menu.
    ho creato un database cosi organizzato in 3 campi
    id
    nome (la voce che dovra comparire nel menu)
    pagina (che saranno homepage.php, servizi.php etc....)
    il risultato e qui
    vorrei che al posto di "pagina" comparisse il nome del campo, che sara quello inserito nel database... invece mi esce "pagina"
    siccome non so che parte d codice postare.... faccio che postarlo tutto...
    codice:
    <?php require_once('../Connections/menu.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;
    }
    }
    
    mysql_select_db($database_menu, $menu);
    $query_RsMenu = "SELECT * FROM menu";
    $RsMenu = mysql_query($query_RsMenu, $menu) or die(mysql_error());
    $row_RsMenu = mysql_fetch_assoc($RsMenu);
    $totalRows_RsMenu = mysql_num_rows($RsMenu);
    ?><!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=utf-8" />
    <title>Documento senza titolo</title>
    <style type="text/css">
    <!--
    a:link {
    	text-decoration: none;
    }
    a:visited {
    	text-decoration: none;
    }
    a:hover {
    	text-decoration: underline;
    }
    a:active {
    	text-decoration: none;
    }
    -->
    </style></head>
    
    <body>
    <div>
      <?php do { ?>
        
    
    Pagina</p>
        <?php } while ($row_RsMenu = mysql_fetch_assoc($RsMenu)); ?></div>
    </body>
    
    </html>
    <?php
    mysql_free_result($RsMenu);
    ?>
    grazie..........
    Trader professionista indipendente
    http://www.j-b.cloud

  2. #2
    Sostituisci:

    Codice PHP:
    >Pagina
    con

    Codice PHP:
    ><?php echo $row_RsMenu['nome']; ?><

  3. #3
    sistemato
    grazie
    Trader professionista indipendente
    http://www.j-b.cloud

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.