jeg har dette php script:
<?
/* MySQL details */
$dbHost = "localhost";
$dbUser = "";
$dbPass = "";
$dbName = "phpforflash";
$table = "downloadLog";
/* 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']);
$link = $row['email'];
$koden = $row['location'];
/* Add details to output variable */
//$list .= "<b>Date:</b> " . $entryDate . "<br>";
$list .= "<b>Name:</b> " . $row['name'] . "<br>";
$list .= " <u><a href=\"
http://$link\" target=\"_blank\">$link</a></b></u>" . "<br>";
//$list .= "<b>Email:</b> " . $row['email'] . "<br>";
$list .= " <a href=\"asfunction:gotoFrame,$koden\">click here to see entry</a>" ."<br>";
$list .= "<b>Location:</b> " . $row['location'] . "<br><br>";
}
/* Output data in required format */
print "&list=" . urlencode($list) . "&";
/* Close link to MySQL */
mysql_close($link);
?>
Jeg skriver så nogen værdier ind i nogle tekst felter i flash disse felter sender jeg så til php.
og jeg får en "list" variable tilbage som jeg så bruger i et tekstfelt i flash.
men det er ikke alle værdier fra mysql som jeg vil have ind i tekstfelten, jeg har brug for en af dem som en seperat variabel.
Jeg brugte dikators superfine:
<a href=\"asfunction:gotoFrame,$koden\">click here to see entry</a>" ."<br>";
til at sende den med, men den funktion kan åbenbart ikke klare ret meget mere end 100 chacters.
og Nikolaj, med php/mysql er jeg i stand til frygtelig lidt :-)