after i have run my query on a mysql db how can i set the result to equal a variable that i will use later on in the page.

i have set the query up like this

<?php
$rand = rand (0, 100);	
$query = "SELECT broad1 FROM images_broad";
$result=mysql_query($query);

while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
$send_mail =$row['broad1'];
}
		     
?>

i dont think the last line is correct though. could anyone please help.

is it correct and this is why i get no reply. or is no one playing out?

you are pulling from all rows in the db. your variable will only display the last rows info. but yes that should work for using that var later in the page.

commented: helpful +1

the end code look like this

$query = "SELECT sent_messages FROM email_count"or die(mysql_error());
$results = mysql_query($query);
$arr = mysql_fetch_array($results);
$sent_mail = $arr[0];

thanks for the reply though