0

I'm now trying to make the sell button, and have a problem.
I try to do the query from data base just like index.php did.
And then I transfer the $rows results to sell_form.php(where show the button).
But it's clearly a error here, how can I fix this?

Here's the picture of the code and error page.
Sell.php
Sell_form.php
Sell.php(web)

1

The query returns what? An array. From Pic 1, $rows looks like this:

$rows[0]["symbol"] = "ATT";
$rows[1]["symbol"] = "MMM";
$rows[2]["symbol"] = "X";  

At the foreach in Pic 2, $stocks is an array of arrays, each $value is an array. Thus the echo provokes the "array to string conversion" error.

3
  • I remember there is a command that can list out what's inside the array and also tell the type of it. But I can't recall it.
    – TwDreamer
    Oct 9 '16 at 5:13
  • I think I found it! it's dump(var).
    – TwDreamer
    Oct 9 '16 at 6:56
  • And through dump, I've found my solution, just add the [symbol] behind my original variable. Since it's a array! Thanks@DinoCoderSaurus
    – TwDreamer
    Oct 9 '16 at 6:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .