Medyman
12-06-2007, 06:49 AM
Hi guys...
Simple question for most of u PHP geniuses out there...
I'm trying to do a very PHP intensive site. I figure it's the only way to really learn.
So, I've been trying to master some of the basics but can't seem to grasp them.
Here is the PHP declaration at the top of my page:
<?php
include 'php/config.php';
include 'php/opendb.php';
$query = "SELECT * FROM mission where section='1'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "{$row['content']}";
$c="{$row['content']}";
}
?>
the "echo" works fine. it echoes what i want it to.
Now, i'm trying to put the same thing that echoes into a variable so that i can use it elsewhere on the page. The data from the MySQL has to be integrated into the page, not just @ the top of the page.
I know there are better techniques then just echoing everything out.
How can I use the info from the content row and insert it into a textarea further down the page?
Also, what if I have another textarea to display info from the same MySQL table but "where section='2'". How would I go about coding that?
Thanks!!!
Simple question for most of u PHP geniuses out there...
I'm trying to do a very PHP intensive site. I figure it's the only way to really learn.
So, I've been trying to master some of the basics but can't seem to grasp them.
Here is the PHP declaration at the top of my page:
<?php
include 'php/config.php';
include 'php/opendb.php';
$query = "SELECT * FROM mission where section='1'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "{$row['content']}";
$c="{$row['content']}";
}
?>
the "echo" works fine. it echoes what i want it to.
Now, i'm trying to put the same thing that echoes into a variable so that i can use it elsewhere on the page. The data from the MySQL has to be integrated into the page, not just @ the top of the page.
I know there are better techniques then just echoing everything out.
How can I use the info from the content row and insert it into a textarea further down the page?
Also, what if I have another textarea to display info from the same MySQL table but "where section='2'". How would I go about coding that?
Thanks!!!