|
Posted by Balazs Wellisch on 09/25/61 11:36
I haven't tested this but how about...
$query = "INSERT INTO tch_content (chattext, chatdate) VALUES
('$chattext',CURDATE())";
$result = mysql_query($query) or trigger_error("Query: $query\n<br/>MySQL
Error: " .mysql_error());
if ($result)
{
//If it ran OK
$query = "SELECT chattext FROM tch_content";
$results = @mysql_query($query);
if ($results)
{
// If it ran OK, display the records
echo '<table><tr>';
echo '<td>Chat text<br>';
echo '<textarea name="whatever" cols="40" rows="15">'.
while( $row = mysql_fetch_array($results, MYSQL_ASSOC) )
{
echo $_SESSION['pass'] . " says ". $row['chattext']."\n";
}
echo '</textarea>';
echo '</td></tr></table>';
mysql_free_result($results);
}
}
mysql_close();
Balazs
"vncntj" <vncntj@hotmail.com> wrote in message
news:1136437977.315740.31310@z14g2000cwz.googlegroups.com...
> I'm trying to post the results into the textarea...
> kinda like chatroom...
>
>
>
> $query = "INSERT INTO tch_content (chattext, chatdate) VALUES
> ('$chattext',CURDATE())";
> $result = mysql_query($query) or trigger_error("Query: $query\n<br
> />MySQL Error: " .mysql_error());
> if ($result) { //If it ran OK
> $query = "SELECT chattext FROM tch_content";
> $results = @mysql_query($query);
> if ($results) { // If it ran OK, display the records
> echo '<table><tr>';
> echo '<td>Chat text</td></tr>';
> //THIS IS WHERE I'M HAVING TROUBLE......
> echo '<textarea value='.
> while ($row = mysql_fetch_array($results, MYSQL_ASSOC)) {
> echo $_SESSION['pass'] . " says ". $row['chattext'];
> } .'</textarea>';
> echo '</table>';
> mysql_free_result($results);
> }
> }
> mysql_close();
> }
>
Navigation:
[Reply to this message]
|