How can I count variables ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aminooo
    New Member
    • Jun 2007
    • 2

    How can I count variables ?

    Hi !

    How can I count variables and put them in a array ?

    Thanks ...
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi, and welcome to TSDN!

    What do you mean? Where are you getting those variables from?
    Could you explain a little better, and perhaps give us an example of your code, if you have any?

    Comment

    • aminooo
      New Member
      • Jun 2007
      • 2

      #3
      Thanks , I have found the solution ...

      [PHP]<?php
      $text = 'text text $asd text';
      preg_match_all( '/\$[a-zA-Z]+/', $text, $matches);
      $fieldName = trim($matches[0][0], "$");
      $query = @mysql_query("S ELECT `$fieldName` FROM `table`");
      ?> [/PHP]

      Comment

      Working...