You are here: Re: results in <textarea> « PHP « IT news, forums, messages
Re: results in <textarea>

Posted by Balazs Wellisch on 12/20/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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация