Comunidad de diseño web y desarrollo en internet online

[Ayuda con Guestbook ├

Citar            
MensajeEscrito el 19 Oct 2008 02:56 pm
quisiera saber si alguno sabe como hacer para q en mi guestbook aparesca las entradas desde arriba.. osea... q cuando hagam clik en enviar aparesca su comentario arriba de la lista y no ababjo como sale... mi web es esta http://www.deroh.com/guestbook.swf desde ya muchas gracias

Por Deroh

25 de clabLevel



 

firefox
Citar            
MensajeEscrito el 19 Oct 2008 03:09 pm
Supongo que tendrás que hacer el loop que parsea los datos recuperados al revés, poco podemos ayudarte si no muestras como cargas los datos

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 19 Oct 2008 03:47 pm
vos decis el php?
es esste

<?
Variables
$DBhost = "mysql3.000webhost.com"; // Database Server
$DBuser = "a8117829_deroh"; // Database User
$DBpass = "argelia666"; // Database Pass
$DBName = "a8117829_deroh"; // Database Name
$table = "guestbook"; // Database Table
$numComments = 999; // Number of Comments per page

$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 "0 Comentarios";
} 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 '' . $name . ' Dijo:<br>' . $comments . '<br><br>';
$i++;
}
}
// Print this only when there aren't any more entries..
if($_GET['NumLow'] > $numallComments) {
print 'No More Entries!&';
}
break;

case 'write' :
// Recieve Variables From Flash
$name = ereg_replace("&", "%26", $_POST['yourname']);
$email = ereg_replace("&", "%26", $_POST['youremail']);
$comments = ereg_replace("&", "%26", $_POST['yourcomments']);
$submit = $_POST['submit'];

// Current system date in yyyy-mm-dd format
$submitted_on = date ("d-m-Y H:i:s",time());

// Check if its submitted from Flash
if($submit == 'Yes'){
// Insert the data into the mysql table
$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());

// If you want your script to send email to both you and the guest, uncomment the following lines of code
// Email Script Begin

/* <-- Remove this line
$MyName = "Mohsin Sumar";
$MyEmail = "[email protected]";
$Subject = "$name has just signed your guestbook.";
$EmailBody = "Hello Mohsin,\n$name has just signed your guestbook available at http://www.mohsinsumar.com. THe following were the details submitted into your guestbook:\n\nName: $name\nEmail: $email\nComment:\n$comments\n";

$EmailFooter = "~~~~~~~~~~~~~~~\nThe guestbook was signed by $name and thus this email got activated by $name from $REMOTE_ADDR from http://www.mohsinsumar.com\n~~~~~~~~~~~~~~~\nThanking you,\nMohsin Sumar";

$Message = $EmailBody.$EmailFooter;

mail($MyName." <".$MyEmail.">",$Subject, $Message, "From: ".$name." <".$email.">");
--> Remove this line */

// Email Script End

print "&gb_status=Thank you for signing my guestbook.&done=yes&";
return;
}
print "&_root.write.gb_status=Error!&";
break;
}
?>


y despues lo otro es el mysql... bueno,.... antes q nada gracias por contestar... :)

Por Deroh

25 de clabLevel



 

firefox
Citar            
MensajeEscrito el 20 Oct 2008 01:59 am
Parece que te lo bajaste de flash-db ;)
En el caso write no te vuelve a mandar los datos, así que el loop es en el lado de Flash, no en el PHP, que lo ordena desde el mas reciente

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 20 Oct 2008 02:11 am
no te entendi perdona... se.. lo baje se flashdb pero lo modifique a mi gusto... ( la apariencia.. )
osea q el problema esta en el .fla?

Por Deroh

25 de clabLevel



 

firefox
Citar            
MensajeEscrito el 20 Oct 2008 09:42 am

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 20 Oct 2008 11:55 am
tns razon.. algo estoy haciendo mal...

Por Deroh

25 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.