i have created a table to store a random number in and now i need the number that has been stored in the db to equal a variable on the new page.

to get the information out of the db i have used this code

$query = "SELECT random1 FROM random_number";

echo "number is{$row['random1']}";

if i wanted the data in the row to set the variable to equl the same number would i write at the bottom instead of of the echo


once the result from the mysql query has been set to be the value of the variable $rand would this then be available for use throughout this page?

the code i have used does set the value of the variable to equal the number that is stored in the db.

would this variable then be able to be used in other parts of the page to then display the variable or is this only available to the mysql query. If i not being clear enough please say and i will try to explain better what i mean.