Comunidad de diseño web y desarrollo en internet online

php, mysql y flash URGENTE POR FAVOR

Citar            
MensajeEscrito el 31 Ago 2004 03:37 pm
bueno, como siempre yo molestando

bien chicos ha surgido otro problema con el proyecto que estoy adelantando.

como ejemplo tengo un archivo .fla y un par de php's.

el primer php genera una base de datos en mysql. El segundo ingresa unos datos desde una interfaz que es el archivo de flash que tengo.

cuando genero la base de datos todo es color de rosa, pero cuando corro el .fla no hace nada, les envío el código php

<?
/* MySQL details */
$dbHost = "localhost";
$dbUser = "root";
$dbPass = "";
$dbName = "phpforflash";
$table = "downloadLog";

/* Attempt connection to MySQL server */
$link = @mysql_connect($dbHost, $dbUser, $dbPass);

/* If connection wasn't successful... */
if (!$link)
{
/* Display error information and quit! */
print "<b>Error:</b> Could not connect to MySQL server!\n";
exit;
}

/* Attempt to select our database */
/* If not able to select... */
if (!@mysql_select_db($dbName))
{
/* Attempt to create database */
/* If not able to create */
if (!@mysql_create_db($dbName))
{
/* Display error information and quit! */
print "<b>Error:</b> Could not create $dbName database";
exit;
}

/* Select newly created database */
@mysql_select_db($dbName);
}

/* Build SQL query to create our downloadLog table */
$query = "CREATE TABLE $table (
entryID INTEGER AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(30),
email VARCHAR(255),
location VARCHAR(100),
entryDate INTEGER)";

/* Execute query */
$result = @mysql_query($query);

/* If there was an error creating the table */
if (!$result)
{
/* Display error information and quit! */
print "<b>Error:</b> Failed to create $table table.\n" . mysql_error();
exit;
}

/* Output success message */
print ">> $table table successfully created!\n";

/* Close database link */
mysql_close($link);

?>
////////////////////////////////////////////////
este genera la bd

este es el otro:


<?

/* MySQL details */
$dbHost = "localhost";
$dbUser = "root";
$dbPass = "";
$dbName = "phpforflash";
$table = "downloadLog";
$name=$_POST["name"];
$email=$_POST["email"];
$location=$_POST["location"];
$list=$_POST["list"];

/* Attempt connection to MySQL server */
$link = @mysql_connect($dbHost, $dbUser, $dbPass);

/* If connection wasn't successful... */
if (!$link) {

/* Return error information to Flash and quit! */
print "&list=" . urlencode("<b>Error:</b> Could not conenct to database") ."&";
exit;
}

/* Attempt to select our database */
/* If not able to select... */
if (!@mysql_select_db($dbName)) {

/* Return error information to Flash and quit! */
print "&list=" . urlencode("<b>Error:</b> Could not find $dbName database") . "&";
exit;
}

/* Fetch current time from server */
$currentTime = time();

/* Build SQL query to insert our information into table */
$query = "INSERT INTO $table (name, email, location, entryDate)";
$query .= "VALUES('$name', '$email', '$location', $currentTime)";

/* Execute query */
$result = mysql_query($query);

/* If there was an error executing query... */
if (!$result) {

/* Return error information to Flash and quit! */
print "&list=" . urlencode("Error: Could not insert record into download log") . "&";
exit;
}

/* Build SQL query to fetch all entries from the table */
$query = "SELECT * FROM $table ORDER BY entryDate DESC";

/* Execute query */
$result = mysql_query($query);

/* If there was a problem with the query... */
if (!$result || @mysql_num_rows($result) < 1) {

/* Return error information to Flash and quit! */
print "&list=" . urlencode("No entries in table $table") . "&";
exit;
}

/* Reset variable to hold output */
$list = "";


/* For each table entry returned... */
while($row = mysql_fetch_array($result)) {

/* Create human readable date from timestamp */
$entryDate = strftime("%A %d/%m/%y", $row['entryDate']);
/* Add details to output variable */
$list .= "Date: " . $entryDate . \n";
$list .= "Name: " . $row['name'] . "\n";
$list .= "Email:" . $row['email'] . "\n";
$list .= "Location: " . $row['location'] . "\n\n";
}

/* Output data in required format */
print "&list=" . urlencode($list) . "&";

/* Close link to MySQL */
mysql_close($link);

?>

/////////////////////////////////////////////////

en el .fla, hay un movie clip gigante que tiene este código:

onClipEvent (data) {
// Data finished loading.
// Let's display it!
this.play();
}

hay cuatro entradas de texto con las variables name, email, location, un texto dinámico con la variable status y un botón con el siguiente código:

on (release) {
// Reset Status message
status = "";

// If all form elements have been filled out...
if (name != "" && email != "" && location != "") {

// Submit the data to our PHP script using the POST method
loadVariables ("register.php", this, "POST");

// Display the loading frame while data loads.
gotoAndStop ("Loading");
} else {

// Otherwise, inform user that all fields are required!
status = "All fields are required";
}
}

hay un loader para cuando se cargan las variables y una pantalla final con la variable list donde se supone aparecen los datos.

aquí está el problema, :| los datos no aparecen en esta variable y si vamos a la bd en mysql no hay nada, les pido por fevor ayuda con esto, la verdad es que esto si es muy urgente. :(

Gracias muchachos

Diego

Por Dnieto23

4 de clabLevel



 

Bogotá - Colombia

unknown
Citar            
MensajeEscrito el 01 Sep 2004 02:48 am
FOR THE HOLY CHRIST AND ALL HIS TEAM!!!!! OMFG!!!!!!!

Perdon ... salio el BOFH en mi

Por favor, ... NO USES LOADVARIABLES ... mis ojos realmente dolieron ... usa LoadVars, con loadVariables jamas sabras si algo funciono . . . aqui esta el tuto de LoadVars:
http://www.cristalab.com/vertutorial.php?id=6

Por Freddie

BOFH

53 tutoriales
597 articulos
43 ejemplos

Genero:Masculino   Admin

Conserje de Cristalab

unknown

 

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