0

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";
$result=mysql_query($query);

while($row=mysql_fetch_array($result)){
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

$rand={$row['random1']};
1
Contributor
2
Replies
3
Views
9 Years
Discussion Span
Last Post by kevin wood
0

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?

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.