Hola amigos, estuve 2 dias luchando modificando el guestbook que saque de una pagina muy conocida, logre editar el mensaje que el usuario dejo
tengo la siguiente estructura el la db
nombre
email
empresa
comentarios
lo que necesito es en flash, 4 textos dinamicos con su respectiva variable y que flash recoja del php y muestre en nombre email...
Porque lo que tengo es en lectura un TextArea y el php recoje los datos y los imprime directamente
alguien me puede ayudar
Código PHP:
// Connect to mySQL Server
$DBConn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Error in GuestBook Application: " . mysql_error());
// Select mySQL Database
mysql_select_db($DBName, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
// Part Two - Choose what action to perform
$action = $_GET['action'];
switch($action) {
case 'read' :
// Fetch all comments from database table
$sql = 'SELECT * FROM `' . $table . '`';
$allComments = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
$numallComments = mysql_num_rows($allComments);
// Fetch page-wise comments from database table
$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);
// Generate Output for Flash to Read
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');
$empresa = mysql_result($fewComments, $i, 'empresa');
$comments = mysql_result($fewComments, $i, 'comments');
$time = mysql_result($fewComments, $i, 'time');
print '<b>Name: </b>' . $name . '<br><b>Email: </b>' . $email . '<br><b>Empresa: </b>' . $empresa . '<br><i>Comments: </b>' . $comments . '<br><i>Date: ' . $time . '</i><br><br>';
$i++;
}
}
// Print this only when there aren't any more entries..
if($_GET['NumLow'] > $numallComments) {
print 'No More Entries!&';
}
break;
}
?>
Codigo AS 2 FLASH 8
Código:
function loadEntries(act, increment) {
// Define NumLow as a Number
num = new Number(_parent.NumLow);
// Act accordingly
if(act == "Next") {
// Add increment
_parent.NumLow = num + increment;
} else if(act == "Previous") {
_parent.NumLow = num - increment;
} else {
// Load default - i.e. 0
_parent.NumLow = 0;
}
// Update Statistics
_parent.read.low.text = _parent.NumLow;
_parent.read.high.text = Number(_parent.NumLow) + 10;
// Show Please wait text
_parent.read.entries.text = "Loading entries... Please wait...";
// Begin Loading
myEntries = new LoadVars()
myEntries.ref = this
myEntries.load("Gues.php?action=read&r="+random(999)+"&NumLow="+_parent.NumLow)
myEntries.onLoad = function(success){
if(success){
// Assign output to components and objects
entries.text = this.entries;
totalEntries.text = this.totalEntries;
//Update values to calculate prev/next button visibility
num = Number(_parent.NumLow)
var totalEntries = Number(this.totalEntries);
var total = num+increment
//Hide/show next button
if(total<totalEntries) this.ref.next_button._visible = true;
else this.ref.next_button._visible = false
//Hide/show previous button
if(num==0) prev_button._visible = false; else prev_button._visible = true
}
}
}
// Load Default
_parent.read.loadEntries("Default", 10);
stop();