I'm not sure what I'm dont wrong here. I query the database for just the logged in users stock symbols so i can display them in the dropdown menu. When i run it the only thing that shows in the drop down is "array".

What am i missing here

            $ava_stocks = CS50::query("SELECT symbol FROM portfolios WHERE user_id = ?",$_SESSION["id"]);

        <div id="middle">
<form action="sell.php" method="post">
    <div class="form-group">
        <select class="form-control" name="symbol">

            <option disabled="" selected="" value="">Symbol</option>
            foreach($ava_stocks as $symbol) 
                echo("<option value= '$symbol'['symbol']>" . $symbol . "</option>");


2 Answers 2


Looks like I just had the syntax wrong. Below is what fixed ti for me.

echo("" . $symbol["symbol"] . "");


@Bogricia: please accept your own answer by clicking on the green check mark. Otherwise, this question will never be marked as answered, and it will haunt the forum forever! Only you can prevent this from becoming a ZOMBIE QUESTION.

You must log in to answer this question.

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