I am having some trouble making a variable in this php file I am working on for a database. Specifically:

echo $row['Symbol'];
$row['Symbol'] = 'symbol';
echo "$symbol";

Now that comes in the middle of a 'while' statement which is calling up the info for a speciifc entry. Let me know if you need to see the whole set of code.

Anyway, I have an entry in the table title "Symbol", and the first "echo $row['Symbol']" works fine, and shows the correct data. It is just the next few lines that spit out a "Undefined variable: symbol.."

This may seem like a silly step for me to even want to do, but I am somewhat a noob at PHP/databases, and need to dynamically generate a URL based on the Symbol of the plant. For instance, in the php file, I want the link: http://plants.usda.gov/cgi_bin/topics.cgi?earl=plant_profile.cgi&symbol= where the Symbol of the plant goes after the "=", so I think the code would look like http://plants.usda.gov/cgi_bin/topics.cgi?earl=plant_profile.cgi&symbol="$symbol"

when the variable is "$row['Symbol'], it is too hard for me to place all the quote marks correct, and it always gives me an error.

Thanks in advance!

    You probably meant to write:

    echo $row['Symbol'];
    $symbol = $row['Symbol'];
    echo "$symbol";

    though it would be simpler to use $row['Symbol'] directly.

      Write a Reply...