Why it won't send this to mysql.Connection is ok.Here is the code.

<?php 
$connect = mysql_connect ("localhost","root","") or die (mysql_error());
mysql_select_db ("login4") or die (mysql_error());

session_start();
$_SESSION['username'];
$username1 = $_SESSION['username'];
$username = $_POST['username'];
$submit = $_POST['submit'];
$micro = $_POST['micro'];
if ($submit){
$queryreg = mysql_query("
INSERT INTO messages VALUES ('','$micro','$username')
");
}
?>
<?php

$sql = mysql_query("SELECT * FROM micro");
$numberofrows = mysql_num_rows ($sql);

$micro = '' ;
while($row = mysql_fetch_array($sql)){ 

	$messages = $row["micro"];
	
	$micro .= ''.$username.'<br />'.$micro.'<br />' ;
}
?>
<?php  
echo $micro; ?>
<form action="micro.php" method="post">
<input type="text" value="<?php echo $username1 ?>" name="username" readonly="readonly" />
<br />
<textarea  name="micro"></textarea>
<br />
<input type="submit" name="submit" value="Blab" />
</form>

Recommended Answers

All 5 Replies

If I am getting you right, you mean to say that your database is not getting updated with the values provided using the INSERT query.
Is that right? Kindly excuse if I got it wrong.

If that is the issue, this line of code should solve it for you:

mysql_query($queryreg,$connect);

Include this after the INSERT query.

You are not running the queries..

Member Avatar for diafol

You should hide the chat interface from guests and only allow logged in users to see it, e.g.

if($logged){
   include('phpchat/chat.php');
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.