0

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>

Edited by web3: n/a

4
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by diafol
0

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.

Edited by webexpertzhere: n/a

0

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');
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.