deepod 0 Report post Posted November 6, 2007 Hi,I am tring to get one single cell from a database. The primary key is username. I want to store the single cell in a variable called $charity. The code below seems to work. However, this outputs to the screen the answer. I want to store the answer in a variable. $query="SELECT charity FROM `users` WHERE username='$username'";$result=mysql_query($query);$row = mysql_fetch_assoc($result);echo $row['charity']; Notice from rvalkass: Code needs to go into CODE tags. List of BBCodes. Share this post Link to post Share on other sites
rvalkass 5 Report post Posted November 6, 2007 The reason is the last line: you echo out the result! Echo is used to output something to the browser, and is often used to output raw HTML code. If you want to store it as a variable, use the following code, in place of your current last line: $charity = $row['charity']; Share this post Link to post Share on other sites