Re: how save elements of an array in database

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

 



Use json instead.. U can store multi-dimentional array and can be used in multi-platform..

Sent from my iPhone

On 04-Nov-2010, at 6:06 PM, Prasad C <prasadcnair@xxxxxxxxx> wrote:

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





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

  Powered by Linux