Hi there I’ve got a guestbook setup to work with my video site. It loads as external swf into an empty mc and stores and loads entries by making calls to SQL table using php file. Everything works fine but I’d like to improve it so it works based on unique video clips IDs. I’ve got many videos on my site and I’d like to store entries based on unique video IDs then retrieve only the relevant entries when a unique video is called. I’m not a SQL/php expert but I understand that I’ll need to create a special column in my SQL table to store unique video IDs and then change the php code so it stores and retrieves entries from the table based on the same unique IDs system.
Does anyone have any ideas or tips on how to do this?
cheers
here is my php code:
$action = $_GET[‘action’];
switch($action) {
case ‘read’ :
$sql = 'SELECT * FROM ' . $table . '';
$allComments = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
$numallComments = mysql_num_rows($allComments);
$sql .= ’ ORDER BY time DESC LIMIT ’ . $_GET[‘NumLow’] . ', ’ . $numComments;
$fewComments = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
$numfewComments = mysql_num_rows($fewComments);
print ‘&totalEntries=’ . $numallComments . ‘&’;
print “<br>&entries=”;
if($numallComments == 0) {
print "No entries in the guestbook, as yet..";
} else {
while ($array = mysql_fetch_array($fewComments)) {
$name = mysql_result($fewComments, $i, 'name');
$email = mysql_result($fewComments, $i, 'email');
$comments = mysql_result($fewComments, $i, 'comments');
$time = mysql_result($fewComments, $i, 'time');
print '<b>Name: </b>' . $name . '<br><b>Comments: </b>' . $comments . '<br><i>Date: ' . $time . '</i><br><br>';
$i++;
}
}
if($_GET['NumLow'] > $numallComments) {
print 'No More Entries!&';
}
break;
case 'write' :
$name = ereg_replace("&", "%26", $_POST['yourname']);
$email = ereg_replace("&", "%26", $_POST['youremail']);
$comments = ereg_replace("&", "%26", $_POST['yourcomments']);
$submit = $_POST['submit'];
$submitted_on = date ("Y-m-d H:i:s",time());
if($submit == 'Yes'){
$sql = 'INSERT INTO ' . $table .
' (`ID`,
`name`,
`email`,
`comments`,
`time`
)
VALUES
(\'\','
. '\'' . $name . '\','
. '\'' . $email . '\','
. '\'' . $comments . '\','
. '\'' . $submitted_on . '\'
)';
$insert = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error());