Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts

    help with Varchar(no#) result

    The query result from this script is a list of columns(FieldNames) in the table showing
    VARCHAR (10)
    VARCHAR (45)
    etc.....

    how would I get a result only showing the Varchar No# 45 without the column name and brackets. The result I am looking for is;
    10
    45
    etc....

    Code:
    <?php
    $query = "SHOW COLUMNS FROM $tablename";
    $result = mysql_query($query);  
    while($columns = mysql_fetch_assoc($result)) {
    echo "<br> $columns[Type]";
    }
    ?>
    Last edited by DataTalk; 12-24-2010 at 06:21 PM.

  • #2
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by DataTalk View Post
    The query result from this script is a list of columns(FieldNames) in the table showing
    VARCHAR (10)
    VARCHAR (45)
    etc.....

    how would I get a result only showing the Varchar No# 45 without the column name and brackets. The result I am looking for is;
    10
    45
    etc....

    Code:
    <?php
    $query = "SHOW COLUMNS FROM $tablename";
    $result = mysql_query($query);  
    while($columns = mysql_fetch_assoc($result)) {
    echo "<br> $columns[Type]";
    }
    ?>
    How would I only allow numeric characters in the string? this might be one way to get the result... anyone?

    PS: Merry Christmas to everyone!!
    Last edited by DataTalk; 12-25-2010 at 06:35 AM.


  •  

    Posting Permissions

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