php-general Digest 7 Dec 2007 10:43:34 -0000 Issue 5168

Topics (messages 265531 through 265549):

PHP Memory Leak
        265531 by: Sascha Braun
        265533 by: Chris
        265534 by: Casey
        265548 by: Jim Lucas

Re: Seeking overlap algorithm
        265532 by: Nathan Nobbe
        265537 by: tedd

Re: Another form handling posting question
        265535 by: Robert Cummings
        265536 by: tedd
        265538 by: Daniel Brown
        265539 by: Daniel Brown
        265540 by: Robert Cummings
        265541 by: Daniel Brown

How to handle rows of checkboxes upon form submit?
        265542 by: Rob Gould
        265543 by: Casey
        265544 by: Stephen Johnson
        265545 by: Casey
        265549 by: slith

convert hex message to ascii msg, How?
        265546 by: Shelley Shyan

Re: how to recognize ENUM column in table?
        265547 by: Jim Lucas

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hi Everybody,

I have a couple of foreach loops which are ending in a for loop,
which causes the apache to consume the complete memory of the
server system the php engine is running on.

The nesting level is at round about three and looking like that:

$num_new = 4;
if (is_array($array)) {
        foreach ($array as $key => value) {
                if ($value['element'] == 'test1') {
                        foreach ($value['data'] as $skey => $svalue) {
                                echo $svalue;
                        }
                } elseif ($value['element'] == 'test2') {
                        foreach ($value['data'] as $skey => $svalue) {
                                echo $svalue;
                        }
                }
                if ($num_new > 0) {

                        // this part causes the memory leak

                        for ($i = 0; $i < $num_new; $i++) {
                                echo "sgasdgga";
                        }
                }       
        }
}

I dont know if the above code is causing the memory leak the source
is a little more complex, if nessessary I will provide some more code,

Thank you!

I hope for a solution

--- End Message ---
--- Begin Message ---
Sascha Braun wrote:
Hi Everybody,

I have a couple of foreach loops which are ending in a for loop,
which causes the apache to consume the complete memory of the
server system the php engine is running on.

The nesting level is at round about three and looking like that:

$num_new = 4;
if (is_array($array)) {
        foreach ($array as $key => value) {
                if ($value['element'] == 'test1') {
                        foreach ($value['data'] as $skey => $svalue) {
                                echo $svalue;
                        }
                } elseif ($value['element'] == 'test2') {
                        foreach ($value['data'] as $skey => $svalue) {
                                echo $svalue;
                        }
                }
                if ($num_new > 0) {

                        // this part causes the memory leak

                        for ($i = 0; $i < $num_new; $i++) {
                                echo "sgasdgga";
                        }
                }       
        }
}

I dont know if the above code is causing the memory leak the source
is a little more complex, if nessessary I will provide some more code,

If you don't know how are we supposed to know? :)

Add

memory_get_usage() calls all over the place and see what's going on.

eg:

error_log(__LINE__ . "\t" . memory_get_usage() . "\n", 3, '/path/to/log.file');

at various spots and go from there.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---




On Dec 6, 2007, at 3:15 PM, Sascha Braun <[EMAIL PROTECTED]> wrote:

Hi Everybody,

I have a couple of foreach loops which are ending in a for loop,
which causes the apache to consume the complete memory of the
server system the php engine is running on.

The nesting level is at round about three and looking like that:

$num_new = 4;
if (is_array($array)) {
   foreach ($array as $key => value)
Typo on above line?
{
       if ($value['element'] == 'test1') {
           foreach ($value['data'] as $skey => $svalue) {
               echo $svalue;
           }
       } elseif ($value['element'] == 'test2') {
           foreach ($value['data'] as $skey => $svalue) {
               echo $svalue;
           }
       }
       if ($num_new > 0) {

           // this part causes the memory leak

           for ($i = 0; $i < $num_new; $i++) {
               echo "sgasdgga";
           }
       }
   }
}

I dont know if the above code is causing the memory leak the source
is a little more complex, if nessessary I will provide some more code,

Thank you!

I hope for a solution

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Sascha Braun wrote:
Hi Everybody,

I have a couple of foreach loops which are ending in a for loop,
which causes the apache to consume the complete memory of the
server system the php engine is running on.

The nesting level is at round about three and looking like that:

$num_new = 4;
if (is_array($array)) {
        foreach ($array as $key => value) {
                if ($value['element'] == 'test1') {
                        foreach ($value['data'] as $skey => $svalue) {
                                echo $svalue;
                        }
                } elseif ($value['element'] == 'test2') {
                        foreach ($value['data'] as $skey => $svalue) {
                                echo $svalue;
                        }
                }

I would do a in_array here..

        if (in_array($value['element'], array('test1', 'test2') ) ) {
                foreach ($value['data'] as $skey => $svalue) {
                        echo $svalue;
                }
        }


                if ($num_new > 0) {
where are you lowering this number? From what I can tell, it is always going to be 4


                        // this part causes the memory leak

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

you have a $i - 0   (a minus sign) not equals

                                echo "sgasdgga";
                        }
                }       
        }
}

I dont know if the above code is causing the memory leak the source
is a little more complex, if nessessary I will provide some more code,

Thank you!

np


I hope for a solution


How about that?

--
Jim Lucas


    "Perseverance is not a long race;
        it is many short races one after the other"

Walter Elliot



    "Some men are born to greatness, some achieve greatness,
        and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
On Dec 6, 2007 4:59 PM, tedd <[EMAIL PROTECTED]> wrote:

> Hi gang:
>
> This post is related to the zip lat/long request I recently made and
> received such an overwhelming response -- many thanks to all.
>
> In any event, let's say we have a end-user who is looking for
> services within his zip-code AND we have a dB of service providers
> who are willing to render service within a set distance (like 50
> miles) from their location.
>
> Now, it's a simple matter to convert the user's zip code to lat/longs
> and then find out how many service providers there are within their
> area and then show that list to the end-user. That's not the problem.
>
> The problem is, could you guarantee to a "preferred" service provider
> that they would receive top-listing 25 percent of the time? Keep in
> mind that preferred service providers will overlap. So, the question
> is how to accommodate for that overlap?
>
> If anyone has an algorithm, I would be interested in hearing it.


i think that should be pretty easy.
the algorithm is dependent upon 2 values.  the number of listings you
consider
as top-listings for each result set and the number of customers that are
registered as preferred customers.
let me illustrate.
imagine you designate only the first entry of the resultant listings as a *
top-listing*.
in that case you can support a maximum of 4 preferred customers before you
can
no longer guarantee to each of the preferred customers their listing will be
a top-listing
25% of the time.  so, if you want more capacity you can increase the number
of
results that are designated as top-listing results.  suppose you increase
the number
to 2, now you have a capacity of 8 customers you can guarantee top-listing
status 25%
of the time.
what you would need to determine is what to do if ever you didnt want to
increment the
number of listings that are designated as top-listing customers and you were
already
at capacity for the number of customers the current capacity supports.
perhaps you
could start charging more at that point.

-nathan

--- End Message ---
--- Begin Message ---
At 6:07 PM -0500 12/6/07, Nathan Nobbe wrote:
On Dec 6, 2007 4:59 PM, tedd <[EMAIL PROTECTED]> wrote:
 > The problem is, could you guarantee to a "preferred" service provider
 > that they would receive top-listing 25 percent of the time? Keep in
 > mind that preferred service providers will overlap. So, the question
 > is how to accommodate for that overlap?
 >
 > If anyone has an algorithm, I would be interested in hearing it.

i think that should be pretty easy. the algorithm is dependent upon 2 values. the number of listings you consider as top-listings for each result set and the number of customers that are registered as preferred customers.

let me illustrate. imagine you designate only the first entry of the resultant listings as a * top-listing*. in that case you can support a maximum of 4 preferred customers before you can no longer guarantee to each of the preferred customers their listing will be a top-listing 25% of the time. so, if you want more capacity you can increase the number
of results that are designated as top-listing results.

suppose you increase the number to 2, now you have a capacity of 8 customers you can guarantee top-listing status 25% of the time.

what you would need to determine is what to do if ever you didnt want to increment the number of listings that are designated as top-listing customers and you were already at capacity for the number of customers the current capacity supports.

Yes, that was pretty easy, but that was not the answer to the question -- my error for not explaining it better.

Let me rephrase the question by providing an example.

Let's say we have a customer base that is spread-out at random over a geographic area. Each customer has designated a 50 mile radius from their location as being within their zone -- the map would look like a bomb saturation map, if you know what I mean.

Now, many of those areas overlap so that if a end-user is within that overlap he can see all the service providers that can provide service. It's a simple matter to pull those providers out of a database depending upon distance and show them to him. After all, that's the way it works, isn't it? The end-user is provided all the service providers who are within their service range.

However, if you are also considering that some of these service providers should be shown as "preferred" (i.e., at the top 25 percent of the time) then you might find yourself in a position of over selling the top position because there may be too many "preferred" service providers in certain areas.

Now, what I need is a way to analyze the distribution of the current service providers to see if a given location is open to being sold as a "preferred" position -- do you see what I mean?

Another example, let's say we have four "preferred" service providers at the same location. Obviously, we could not sell another "preferred" position within 100 miles.

Another example, let's say we have four "preferred" service providers 100 miles apart, clearly we can sell more "preferred" positions. But, the number of positions available depends upon the distribution of the original four. If they were located in a straight line, then we could sell two positions between each one. But, if they were distributed in a square, we could only sell one. Do you see?

I know what solution I will be using unless someone comes up with something different. I just want to tap this knowledgeable group before I spin my wheels trying to solve a problem, that may be already solved.

Thanks, for your time.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Thu, 2007-12-06 at 13:02 -0500, tedd wrote: 
> At 10:36 PM -0700 12/5/07, Mike Smith wrote:
> >I am trying to recursively send data to the same form.
> >
> >-snip-
> >
> >What is the best practice for doing this?
> >
> 
> I don't know what the "best" practice is, but this is the way I do it.
> 
> In the form I have a hidden field called step that controls flow via POST..
> 
> Based upon that value, I use a switch to direct the flow to different 
> forms -- all the forms have the same submit button.
> 
> So, it looks like this (pseudo-code):
> 
> $step = isset($_POST['step']) ? $_POST['step'] : 1;
> 
> <form action=self method=post>
> 
> switch $step
>    {
>    case 1:
>    // present the form for step 1
>    <input hidden step=2>
> 
>    case 2:
>    // present the form for step 2
>    <input hidden step=3>
> 
>    case 3:
>    // present the form for step 3
>    }
> 
> <input type=submit name=submit type=submit>
> 
> That way, it's simple to recursively change a form to gather information.
> 
> If you want to keep/store data in each gather, then either save it to 
> a dB or do sessions.
> 
> It works for me.

Not to critique your form logic itself, but IMHE it is much better to
name the submit button "continue" and not "submit". Some browsers, maybe
all (I can't remember), screw things up when you try to do form.submit()
in JavaScript if there is a field called submit.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
At 9:02 PM -0500 12/6/07, Robert Cummings wrote:
On Thu, 2007-12-06 at 13:02 -0500, tedd wrote:

 >
 > <input type=submit name=submit type=submit>


Not to critique your form logic itself, but IMHE it is much better to
name the submit button "continue" and not "submit". Some browsers, maybe
all (I can't remember), screw things up when you try to do form.submit()
in JavaScript if there is a field called submit.

Cheers,
Rob.

Rob

As always, you are right. I wasn't thinking about js.

Also, I recently noticed that FF will add text to a Submit button if you don't.

There are lot's of things to remember here.

Thanks,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Dec 6, 2007 9:10 PM, tedd <[EMAIL PROTECTED]> wrote:

> Also, I recently noticed that FF will add text to a Submit button if you 
> don't.

    Actually, Tedd, even second-generation browsers (e.g. - Internet
Exploder 2.x, Netscape Navigator 2.x, et cetera) would add the text
"Submit Query" to a button if there was no ``value="Something"``
included in the tag.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

--- End Message ---
--- Begin Message ---
On Dec 6, 2007 9:49 PM, tedd <[EMAIL PROTECTED]> wrote:
> >On Dec 6, 2007 9:10 PM, tedd <[EMAIL PROTECTED]> wrote:
> >
> >>  Also, I recently noticed that FF will add text to a Submit button
> >>if you don't.
> >
> >     Actually, Tedd, even second-generation browsers (e.g. - Internet
> >Exploder 2.x, Netscape Navigator 2.x, et cetera) would add the text
> >"Submit Query" to a button if there was no ``value="Something"``
> >included in the tag.
>
> Duh!
>
> That's like telling everyone to use the shower-head to water-pic your
> teeth as Vana White did -- like obvious!
>
> Oh well, I never said I was smart -- I just said I recently saw it.
> But, in my defense, I have always done it right so I never saw it
> until I ran someone one else's code that did it wrong.
>
> My technical side is like Swiss cheese -- you never know what holes I
> don't know and can be surprised at what I do.


    Keep your replies on-list, old man!  ;-P

    I know others enjoy your wit as much as I do!

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

--- End Message ---
--- Begin Message ---
On Thu, 2007-12-06 at 21:52 -0500, Daniel Brown wrote:
> On Dec 6, 2007 9:49 PM, tedd <[EMAIL PROTECTED]> wrote:
> > >On Dec 6, 2007 9:10 PM, tedd <[EMAIL PROTECTED]> wrote:
> > >
> > >>  Also, I recently noticed that FF will add text to a Submit button
> > >>if you don't.
> > >
> > >     Actually, Tedd, even second-generation browsers (e.g. - Internet
> > >Exploder 2.x, Netscape Navigator 2.x, et cetera) would add the text
> > >"Submit Query" to a button if there was no ``value="Something"``
> > >included in the tag.
> >
> > Duh!
> >
> > That's like telling everyone to use the shower-head to water-pic your
> > teeth as Vana White did -- like obvious!

Am I getting old if I remember that clip on TV? :B

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
On Dec 6, 2007 10:31 PM, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Thu, 2007-12-06 at 21:52 -0500, Daniel Brown wrote:
> > > Duh!
> > >
> > > That's like telling everyone to use the shower-head to water-pic your
> > > teeth as Vana White did -- like obvious!
>
> Am I getting old if I remember that clip on TV? :B

    Yes....

    .... but at least you're in good company.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

--- End Message ---
--- Begin Message ---
Let's say I have a PHP script which lists a series of objects for sale at a 
yard sale, each with a checkbox to the left of the name of the item.

If I wanted to have a submit button, and run through the list of items that 
were checked and act on them, how would I do that?

To gain some knowledge, I went into phpMyAdmin and looked at their checkboxes, 
and I see their code:

<input type="checkbox" id="checkbox_row_6" value="apples" name="selected_fld[]">
<input type="checkbox" id="checkbox_row_7" value="oranges" 
name="selected_fld[]">
<input type="checkbox" id="checkbox_row_8" value="bananas" 
name="selected_fld[]">


So it looks like they do something with name="select_fld[]", which must be part 
of the secret to making this work.

Any advice is greatly appreciated.

--- End Message ---
--- Begin Message ---
On Dec 6, 2007 10:12 PM, Rob Gould <[EMAIL PROTECTED]> wrote:
> Let's say I have a PHP script which lists a series of objects for sale at a 
> yard sale, each with a checkbox to the left of the name of the item.
>
> If I wanted to have a submit button, and run through the list of items that 
> were checked and act on them, how would I do that?
>
> To gain some knowledge, I went into phpMyAdmin and looked at their 
> checkboxes, and I see their code:
>
> <input type="checkbox" id="checkbox_row_6" value="apples" 
> name="selected_fld[]">
> <input type="checkbox" id="checkbox_row_7" value="oranges" 
> name="selected_fld[]">
> <input type="checkbox" id="checkbox_row_8" value="bananas" 
> name="selected_fld[]">
>
>
> So it looks like they do something with name="select_fld[]", which must be 
> part of the secret to making this work.
>
> Any advice is greatly appreciated.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Use this code:
<?php if (empty($_POST) { ?>
<form action="" method="post">
 <input type="checkbox" id="checkbox_row_6" value="apples"
name="selected_fld[]" />
 <input type="checkbox" id="checkbox_row_7" value="oranges"
name="selected_fld[]" />
 <input type="checkbox" id="checkbox_row_8" value="bananas"
name="selected_fld[]" />
 <button type="submit">Submit<button>
</form>
<?php
 } else echo '<pre>', print_r($_POST, true), '</pre>';
?>

This will print out the postdata, along with the "secrets" to how this works.

-Casey

--- End Message ---
--- Begin Message ---
You will be passing the checkboxes as arrays ...

So you will need to access them that way on the next page

Your post field would look something like  (off the top of my head, so don't
quote me): 

     

Array
(
    [selected_fid] =>
                            [0] => apples
                            [1] => oranges
                            [2] => bananas
) 


This assumes that the user selected all the results.  If for instances they
did not (say they checked apples and bananas), then your post array would
look like :
Array
(
    [selected_fid] =>
                            [0] => apples
                            [1] => bananas
) 


The array will automatically increment starting at zero.  However, you can
prefill the array with specific information, in case you need to know which
boxes where checked and which were not...

<INPUT TYPE="checkbox" ID="checkbox_row_6" NAME="selected_fid[1]"
VALUE="apples"> 

There is no reason to do this with hardcode values, but if you were
accessing information from a database, and dynamically creating a series of
checkboxes, then it would be more useful to preload the array with the id
from the database rather then let it auto increment.

Hope you find this useful.


I would suggest for your reading enjoyment :

http://php.net/array

http://us.php.net/manual/en/reserved.variables.php  // specifically the
section on $_POST



--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




> From: Rob Gould <[EMAIL PROTECTED]>
> Date: Thu, 06 Dec 2007 22:12:22 -0800
> To: <[EMAIL PROTECTED]>
> Subject: [PHP] How to handle rows of checkboxes upon form submit?
> 
> Let's say I have a PHP script which lists a series of objects for sale at a
> yard sale, each with a checkbox to the left of the name of the item.
> 
> If I wanted to have a submit button, and run through the list of items that
> were checked and act on them, how would I do that?
> 
> To gain some knowledge, I went into phpMyAdmin and looked at their checkboxes,
> and I see their code:
> 
> <input type="checkbox" id="checkbox_row_6" value="apples"
> name="selected_fld[]">
> <input type="checkbox" id="checkbox_row_7" value="oranges"
> name="selected_fld[]">
> <input type="checkbox" id="checkbox_row_8" value="bananas"
> name="selected_fld[]">
> 
> 
> So it looks like they do something with name="select_fld[]", which must be
> part of the secret to making this work.
> 
> Any advice is greatly appreciated.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
On Dec 6, 2007 10:25 PM, Casey <[EMAIL PROTECTED]> wrote:
>
> On Dec 6, 2007 10:12 PM, Rob Gould <[EMAIL PROTECTED]> wrote:
> > Let's say I have a PHP script which lists a series of objects for sale at a 
> > yard sale, each with a checkbox to the left of the name of the item.
> >
> > If I wanted to have a submit button, and run through the list of items that 
> > were checked and act on them, how would I do that?
> >
> > To gain some knowledge, I went into phpMyAdmin and looked at their 
> > checkboxes, and I see their code:
> >
> > <input type="checkbox" id="checkbox_row_6" value="apples" 
> > name="selected_fld[]">
> > <input type="checkbox" id="checkbox_row_7" value="oranges" 
> > name="selected_fld[]">
> > <input type="checkbox" id="checkbox_row_8" value="bananas" 
> > name="selected_fld[]">
> >
> >
> > So it looks like they do something with name="select_fld[]", which must be 
> > part of the secret to making this work.
> >
> > Any advice is greatly appreciated.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> Use this code:
> <?php if (empty($_POST) { ?>
> <form action="" method="post">
>  <input type="checkbox" id="checkbox_row_6" value="apples"
> name="selected_fld[]" />
>  <input type="checkbox" id="checkbox_row_7" value="oranges"
> name="selected_fld[]" />
>  <input type="checkbox" id="checkbox_row_8" value="bananas"
> name="selected_fld[]" />
>  <button type="submit">Submit<button>
> </form>
> <?php
>  } else echo '<pre>', print_r($_POST, true), '</pre>';
> ?>
>
> This will print out the postdata, along with the "secrets" to how this works.
>
> -Casey
>

Sorry, parse error :]

<?php if (empty($_POST)) { ?>
<form action="" method="post">
 <input type="checkbox" id="checkbox_row_6" value="apples"
name="selected_fld[]" />
 <input type="checkbox" id="checkbox_row_7" value="oranges"
name="selected_fld[]" />
 <input type="checkbox" id="checkbox_row_8" value="bananas"
name="selected_fld[]" />
 <button type="submit">Submit<button>
</form>
<?php
 } else echo '<pre>', print_r($_POST, true), '</pre>';
?>

This basically says what Stephen said.
-Casey

--- End Message ---
--- Begin Message ---
foreach($_POST['selected_fld'] as $key => $val){
        echo 'KEY:' $key . ' - VALUE:' . $val . '<br />';
}

Rob Gould wrote:
Let's say I have a PHP script which lists a series of objects for sale at a 
yard sale, each with a checkbox to the left of the name of the item.

If I wanted to have a submit button, and run through the list of items that 
were checked and act on them, how would I do that?

To gain some knowledge, I went into phpMyAdmin and looked at their checkboxes, 
and I see their code:

<input type="checkbox" id="checkbox_row_6" value="apples" name="selected_fld[]">
<input type="checkbox" id="checkbox_row_7" value="oranges" 
name="selected_fld[]">
<input type="checkbox" id="checkbox_row_8" value="bananas" 
name="selected_fld[]">


So it looks like they do something with name="select_fld[]", which must be part 
of the secret to making this work.

Any advice is greatly appreciated.

--- End Message ---
--- Begin Message ---
Hi all,

How could I convert a hex msg to ascii msg?
Is there a php function or sth?

Thanks.

Regards,
Shelley


--- End Message ---
--- Begin Message ---
Afan Pasalic wrote:
hi,
I use the code from
http://www.php.net/manual/en/function.mysql-fetch-field
(example #1)
I'm getting everything I need but can't recognize if the column is ENUM() type?

e.g. column "status" is ENUM('0','1') or ENUM('live','hidden','archive') or something like that. I want to recognize this column and then create a form with radio buttons
o 0   o 1 or
o live   o hidden   o archive

is it possible?

thanks.

-afan


Try something like this.


my table structure was

 CREATE TABLE `cmsws_com`.`examples` (
`col1` ENUM( '0', '1' ) NOT NULL ,
`col2` ENUM( 'one', 'two', 'three' ) NOT NULL
) ENGINE = MYISAM


<?php

# setup your db connection and stuff...

$result = mysql_query("SHOW COLUMNS FROM examples");
if (!$result) {
    echo 'Could not run query: ' . mysql_error();
    exit;
}
if (mysql_num_rows($result) > 0) {
    while ($row = mysql_fetch_assoc($result)) {
        print_r($row);
    }
}


My results were

Array
(
    [Field] => col1
    [Type] => enum('0','1')
    [Null] => NO
    [Key] =>
    [Default] =>
    [Extra] =>
)
Array
(
    [Field] => col2
    [Type] => enum('one','two','three')
    [Null] => NO
    [Key] =>
    [Default] =>
    [Extra] =>
)


Hope this fits the bill


--
Jim Lucas


    "Perseverance is not a long race;
        it is many short races one after the other"

Walter Elliot



    "Some men are born to greatness, some achieve greatness,
        and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---

Reply via email to