Hi
Im creating a portofolio for myself, and im trying to make it database dependent, so i can update it through mysql and php. Im loading my vars from a database called portofolio, where i want to load a title, description, id, and a url to an image. In my fla i have the following code:
//postition of the first thumbnail
var nextx:Number = 25;
var nexty:Number = 25;
//which row it should be placed on
var row:Number = 0;
//function for duplicating movieclip
dupMovie = function () {
//for loop running through, for instance, 23 thumbnails
for (i=1; i<23; i++) {
//thumb gets duplicated and assigned a new x y position
thumb.duplicateMovieClip("thumb"+i, i, {_x:nextx, _y:nexty} );
//trace the name of the newest thumb
trace ("thumb"+i);
//new row is being made
row = row + 1;
//next thumbnails x position is set
nextx = nextx + 110;
//if loop sets the new row, if previous is filled out
if (row >= 5 ) {
nexty = nexty + 110;
nextx = 25;
row = 0;
};
};
};
//executes the dupMovie() funtion
dupMovie();
At the movieclip “thumb” im using this code:
onClipEvent (load) {
//assuming you have a personal web server and PHP installed locally
loadVariables("http://localhost:8888/loadvars.php", this, "GET");
}
… referring to the php file loadvars.php:
<?php
$host="localhost";
$user="root";
$password="root";
$dbname="indhold";
$cxn=mysqli_connect($host,$user,$password,$dbname)
or die ("Kunne ikke oprette forbindelse til databasen.");
$i = 1;
$query="(SELECT * FROM portofolio)";
$result=mysqli_query($cxn,$query)
or die ("kunne ikke oprette forbindelse til databasen indhold.");
while ( $row=mysqli_fetch_assoc($result))
{
extract($row);
print "id$i=$id";
print "<br>";
$i++;
}
?>
Now, i would like to have all the data from the DB imported using only one query, and then have it displayed in the thumbnail duplicates.
Is this possible in any easy way, do you know any good tutorials or am i on my on this one?
Cheers
/Aske