www.webdeveloper.com
Results 1 to 5 of 5

Thread: [RESOLVED] Creating the variable name from the value of another variable

  1. #1
    Join Date
    Sep 2006
    Posts
    3

    resolved [RESOLVED] Creating the variable name from the value of another variable

    I have field name.

    PHP Code:
    $name_field=mysql_field_name($fields$i); 
    and I need to create a variable with a name equal to the value of $name_field.

    Please, help.

  2. #2
    Join Date
    Jan 2005
    Location
    Alicante (Spain)
    Posts
    7,742
    Code:
    $$name_field = $value;

  3. #3
    Join Date
    Sep 2006
    Posts
    3
    Thanks! It works.

  4. #4
    Join Date
    Oct 2006
    Posts
    1
    hi, i need to chage the columns names (id_emp_fr , develop-area) to something more especific to show on my lists...
    like

    for ($i=0; $i < $fields; $i++) {

    $name = mysql_field_name($Resultado, $i); //column's names in BD
    echo $name. " "; //Shows: id_empleado_vi nombres dep-1 are-1 sueldo

    }

    I need to show the headers like:

    <? if ($name=="id_empleado_vi") $name="REGISTRO";
    echo $name. " "; // REGISTRO nombres dep-1 are-1 sueldo
    ?>

    But taking the reemplace names from other php file.

    Please, i need this... sorry my poor english.
    Cheers!

  5. #5
    Join Date
    Jan 2005
    Location
    Alicante (Spain)
    Posts
    7,742
    Post some of the surrounding code so it is obvious what is happening. ¿Que quieres hacer?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles