Re: [PHP-DB] weird string literal related problem

[email protected] (Ratin) Mon, 1 Aug 2016 12:25:08 -0700
Newsgroups php.db
Message-ID <CAC0DzxzcW3LxLOKRLcGHAuXxYOf2ABvwMXLAcwiUwT_FXTxbKQ@mail.gmail.com>
--001a1144d1feec43f00539078eaa
Content-Type: text/plain; charset=UTF-8

Thanks Aziz, that works. Somehow i thought the ' needed to be included just
like you quote all strings on an interactive DB shell or even when you get
the value directly by column name.

On Mon, Aug 1, 2016 at 11:47 AM, Aziz Saleh <[email protected]> wrote:

> But if i print $entries['decoderUserGUID'] I get the correct value
>
> This means the key value is decoderUserGUID NOT 'decoderUserGUID', try
> creating $strIndex without the quotes, just the key value.
>
> On Mon, Aug 1, 2016 at 2:31 PM, Ratin <[email protected]> wrote:
>
>> Hi I am new to this list, not sure how active this list is but i have a
>> question regarding php-sqlite integration. I am using a string variable
>> where I put the column name and trying to use that varible to get its
>> value, in a loop. So here is what I have (simplified version):
>>
>>
>> $strIndex='\'' . $columns[$i] . '\'';  //strIndex has the value :
>> 'decoderUserGUID'  (including quotes)
>> $result = $db->query('select * from DecoderUser');
>> while ($entries = $result->fetchArray())
>> {
>>     $value=$entries[$strIndex];
>> }
>>
>>
>>
>> So if I print $value, I get nothing. But if i print
>> $entries['decoderUserGUID'] I get the correct value. If I print $strIndex,
>> I get 'decoderUserGUID' (including the quotes). How can I solve this
>> mistery.. whats hapenning here , Anybody have any idea?
>>
>>
>> Thanks
>>
>> Ratin
>>
>
>

--001a1144d1feec43f00539078eaa--