Hi,
I have looked at the count sql function, and this looks like it will be
useful, however my coding knowledge is not high.
At present this sort of code is being used to access the database and also the
flash to display it.
<?php
$connect = mysql_connect("localhost", "user", "pass");
mysql_select_db("database_name", $connect);
$result = mysql_query("SELECT Title, Comments, Image FROM titles");
$cant = 0;
while($row=mysql_fetch_array($result)){
echo
"Title$cant=$row[Title]&Comments$cant=$row[Comments]&Image$cant=$row[Image]&";
$cant++;
}
echo "cant=$cant";
?>
Actionscript -
//Create LoadVars object and load file
myData = new LoadVars()
myData.load("file_name.php") //php line
myData.ref = this
//Fetch data
myData.onLoad = function(succes){
if(succes){
for(var i=0; i<this.cant; i++){
this.ref["Title_txt"+i].htmlText = "[B]"+this["Title"+i]+"[/B]"
this.ref["Comments_txt"+i].text = this["Comments"+i]
this.ref["holder_mc"+i].loadMovie(this["Image"+i])
}
} else trace("Error loading data");
}
Any ideas on how to approach the problem, and any useful links would be great
thanks
Gavin
MotionMaker - 22 Feb 2007 15:39 GMT
Send the total row count back and on the AS side you need to do math to
determine what number of views you have. If you show 12 images, the divide the
total row count by 12 and if you have a remainder add 1 to get the total views.
In this case view 1 is always 1-12 and view 2 is always 13-25.
PHP
$numrows = mysql_num_rows($result);
echo "cant=$cant&count=$numrows";