This question already has an answer here:
Need help on the condition for while loop to echo the user and message. When I tried changing the while loop to an if/else loop it will always go to the else loop.
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
$uname = $_REQUEST['uname'];
$msg = $_REQUEST['msg'];
$con = mysql_connect("localhost","root","");
MYSQL_SELECT_DB("chatbox");
mysql_query("INSERT INTO logs ('username','msg') VALUES ('$uname','$msg')");
$result1 = mysql_query("SELECT * FROM logs ORDER by id DESC");
while($extract = mysql_fetch_array($result1)){
echo $extract['usernme'] . " : " . $extract['msg'] . "<br>";
}
?>
Aucun commentaire:
Enregistrer un commentaire