CREATE TABLE IF NOT EXISTS `users` (
`ID` mediumint(9) NOT NULL AUTO_INCREMENT,
`username` varchar(60) DEFAULT NULL,
`password` varchar(60) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
CREATE TABLE IF NOT EXISTS `chatmessage` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`from` varchar(250) NOT NULL,
`to` varchar(250) NOT NULL,
`message` text NOT NULL,
`timestamp` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
$query =("SELECT * FROM users ");
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result))
{
$users=$row['username'];
echo"<a href='chat.php'>$users</a><br>";
}
Above while loop gives users from database.
How to chat with one or multiple users listed inside anchor tag?