Problem inserting string into array

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tycoon79
Forum Newbie
Posts: 4
Joined: Fri Jan 23, 2009 5:12 am

Problem inserting string into array

Post by tycoon79 »

Hi..i'm trying to insert an implode generated string to an array that then later be used for json implementation

the implode generated string is look like this

Code: Select all

    'id' => $this->_SqlResult[0],'UserId' => $this->_SqlResult[1],'Msg' => $this->_SqlResult[2],'MsgStamp' => $this->_SqlResult[3]
i would like to used it in this code

Code: Select all

 $this->_JsonArr[]=array($Generated string);
to achieve something like this

Code: Select all

  $this->_JsonArr[]=array('id' => $this->_SqlResult[0],'UserId' => $this->_SqlResult[1],'Msg' => $this->_SqlResult[2],'MsgStamp' => $this->_SqlResult[3]);
instead i got something like this

Code: Select all

  $this->_JsonArr[]=array(" 'id' => $this->_SqlResult[0],'UserId' => $this->_SqlResult[1],'Msg' => $this->_SqlResult[2],'MsgStamp' => $this->_SqlResult[3]");

seem like generated string is treated as one element as key and value pair.
obviously i can get expected output from mysql because of this, can anybody help me with this
Post Reply