Ask a Question related to PHP Development, Design and Development.
-
Captain Nemo #1
This should be easy, but...
Hi
I'm trying to build a simple, one-dimensional array of prices, where the key
to each element is the product code.
So I start by executing a select query "SELECT Code, Price FROM Products",
and the results are returned in a two-dimensional array, $data, which I can
loop through like this:
while (list(, $value) = each($data))
{
$code = $value[0];
$price = $value[1];
I would have thought I could build my array here by writing something like:
$command = "\$arr['$code'] = $price;";
exec($command);
But this doesn't work.
Can anyone explain?
Captain Nemo Guest
-
Help please...It must be very easy
Hello I?m having problems in making AV presence component to connect without using simple connect...I need to broadcast video from a webcam to... -
Do you know CF? This one should be easy
I'm relatively new to CF and programming so bear with me on this one. If I was receiving form data with input field names such as form.option1,... -
Easy question = easy answer?
Well, so I'm pretty new with Freehand, at the mo running with MX and havin' a problem (not big, but anyway)... I'm creating some cards and they... -
probably easy for you, but . . .
Over the years, believe it or not, I have never used Multiple select boxes. Now, can someone tell me where I can see some sample code for how to get... -
Easy Question/Easy Answer
Ok, this is all i want to know how to do, i made a text link, now when someone rolls over it with their pointer i want it to change color. Simple? -
Captain Nemo #2
OK - Mystery solved!!!
Panic over!
I was confusing the exec() function with the eval() function.
Captain Nemo Guest
-
Virgil Green #3
Re: This should be easy, but...
"Captain Nemo" <Captain@NoSpam.com> wrote in message
news:CaU7d.1716$xb.1032@text.news.blueyonder.co.uk ...key> Hi
>
> I'm trying to build a simple, one-dimensional array of prices, where thecan> to each element is the product code.
>
> So I start by executing a select query "SELECT Code, Price FROM Products",
> and the results are returned in a two-dimensional array, $data, which Ilike:> loop through like this:
>
> while (list(, $value) = each($data))
> {
> $code = $value[0];
> $price = $value[1];
>
> I would have thought I could build my array here by writing somethingeval (as you mentioned in your followup) is not needed either. Simply use:>
> $command = "\$arr['$code'] = $price;";
> exec($command);
>
$arr[$code]=$price;
by using eval, you appear to be attempting to force the subscript to be a
literal value and that isn't necessary.
- Virgil
Virgil Green Guest



Reply With Quote

