help with swf and php guestbook
Would anybody be able to tell me where I'm going wrong with my guestbook, I downloaded the guestbook and customised to fit in with my site. I have followed the setup procedure but somehoe it's not working. It is an swf and php, I just can't get my head around why it's not working. The board can be seen at www.thismeatisfresh.com
I have never used php before so I'd really appreciate if someone can have a look for me.
PHP Code:
<?php
//---------------------------------ENTER YOUR DATABASE DETAILS HERE(IF NOT SURE ASK YOUR HOST FOR THE DETAILS-------------//
//mysql details
$host = "mysql.thismeatisfresh.com"; //e.g may look like mysql2.yourdomain.net
$username = "graphikdzine";
$password = "dan8055";
$db = "mysqlguestbook";
//---------------------------------------------- DO NOT CHANGE FOLLOWING (UNLESS U KNOW WHAT UR DOING) -------------------//
if(isset($_POST['name'])){
//retrieve variables
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$date = date("Y-m-d");
}
//create connection to the database
$conn = mysql_connect($host, $username, $password) or die("could not connect to server");
$select_db = mysql_select_db($db,$conn);
if(isset($_POST['name'])){
//insert entry into guest book
$insertSQL = "INSERT INTO guestbook_tbl (Name, Email, Message, Date) VALUES ('$name', '$email', '$message', '$date')";
$rs = mysql_query($insertSQL,$conn);
if($rs){
//insertion was successful now lets send back to flash all entries in the database in XML Format
retrieveData();
}else{
echo '&entryadded=FAIL&';
exit();
}
}else{
retrieveData();
}
function retrieveData(){
global $conn;
//get entries from guestbook
$selectSQL = "SELECT * FROM guestbook_tbl ORDER BY ID DESC";
$rs = mysql_query($selectSQL,$conn);
//generate the xml file
echo "<?xml version=\"1.0\"?>\n";
echo "<entries>\n";
while($row = mysql_fetch_assoc($rs)){
echo "<log>\n";
echo "<name>".$row['Name']."</name>\n";
echo "<email>".$row['Email']."</email>\n";
echo "<date>".$row['Date']."</date>\n";
echo "<message>".$row['Message']."</message>\n";
echo "</log>\n";
}
#now lets end the xml file
echo "</entries>\n";
#close the mySQL connection
mysql_close($conn);
}
?>
Cheers,
Dan