Hallo,
bin seit kurzem hier angemeldet und möchte gerne diese shoutbox auf meiner indexseite integrieren. Eine MySQL Datenbank habe ich schon angelegt und folgende PHP Dateien auf meinem Server hinterlegt. Trotzdem funktioniert das ganze nicht. Vorbild war dieses Video. https://www.youtube.com/watch?v=_XBeGcczFJo
Wäre cool wenn mir jemand sagen könnte , was am code falsch ist.
index.php: <?php ?> Chat Box Enter Your Chatname:
Your Message:
<a href= “#” onclick= "submitChat()"class= “button”>Send
insert.php:
<?php $uname = $_REQUEST['uname']; $msg = $_REQUEST['msg']; $con = mysql_connect('localhost', 'root', ''); mysql_select_db('chatbox', $con); 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['username']. "</span:" . $extract['msg']. ""; } ?>
logs.php:
<?php $con = mysql_connect('localhost', 'root', ''); mysql_select_db('chatbox', $con); $result1 = mysql_query("SELECT * FROM logs ORDER by id DESC"); while($extract = mysql_fetch_array($result1)){ echo "". $extract['username']. "</span:" . $extract['msg']. ""; } ?>