Re: how save elements of an array in database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If that's single dimensional array, implode it to string and store in DB as
VARCHAR or MEDIUMTEXT or TEXT.
Use explode when you want it back to array..

On Thu, Nov 4, 2010 at 1:37 PM, Joseph Griffin <griffinhere@xxxxxxxxx>wrote:

>
>
> you may use simple "foreach" loop for that.
>
> <?php
> $arr = array("one", "two", "three");
>
> foreach ($arr as $value) {
> $insertDbSql = "INSERT INFO `myTbl` VALUES('$value')";
> }
> ?>
>
> ________________________________
> From: melissa_brown35 <melissa_brown35@xxxxxxxxx<melissa_brown35%40yahoo.com>
> >
> To: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com>
> Sent: Tue, November 2, 2010 2:52:03 PM
> Subject:  how save elements of an array in database
>
>
> how save elements of an array in database when we do not know that how many
>
> elements are in array Like elements might be 5 or 10.
>
> [Non-text portions of this message have been removed]
>
>  
>



-- 
-Prasad C
+91 994 672 5488
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please don't print this e-mail unless absolutely necessary, lets save some
trees, and Mother Nature


[Non-text portions of this message have been removed]



------------------------------------

Are you looking for a PHP job?
Join the PHP Professionals directory Now!
http://www.phpclasses.org/jobs/
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php-objects/join
    (Yahoo! ID required)

<*> To change settings via email:
    php-objects-digest@xxxxxxxxxxxxxxx 
    php-objects-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux