SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist dscriptor's Avatar
    Join Date
    Oct 2005
    Location
    in front of my computer
    Posts
    571
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question assign dynamically an id

    hi all,

    my code is :

    PHP Code:
           $sql "SHOW TABLES";
        
        
    $result $db->db_query($sql);
        
            
        if (!
    $result) {
           echo 
    "DB Error, could not list tables\n";
           echo 
    'MySQL Error: ' mysql_error();
           
        }
        
        
         while(
    $row $db->db_fetch_array($result)) {
                    
    $tblArr[] = $row;
                 
                } 
    //END OF WHILE 
    ok, i can get the names of the tables from my database, but the problem is how can i assign a Unique ID for each item to be used for other processes.

    as you can see, when you execute the SQL command "SHOW TABLES", it will just display a one column - list of the names - and no id/number for each item...

    i hope it makes sense..

    please help me here...thanks!
    happy is the man that finds wisdom....wisdom in {PHP}.


  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    the names are unique, so just use the name
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Evangelist dscriptor's Avatar
    Join Date
    Oct 2005
    Location
    in front of my computer
    Posts
    571
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hahaha

    OH YESS!! why didn't i think about it?

    thanks!
    happy is the man that finds wisdom....wisdom in {PHP}.



Bookmarks

Posting Permissions

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