Hello,
I am trying to make a simple flash database with next and previous buttons. I am getting it the limit the rows fine but am having a bit of trouble getting the next and previous buttons to work.
Here is the php script
<?php #### connection ###
mysql_connect(
"localhost",
"root",
"pass"
) or die("Could not connect: " . mysql_error());
mysql_select_db("database_name");
$CID = substr($CID, 0, 3);
$CID = EscapeShellCmd($CID);
$limitrow = (($CID - 1) * 3);
$query = "SELECT * FROM names LIMIT $limitrow, 3";
?>
<?
$result=mysql_query($query);
$Data='';
$numRows=mysql_num_rows($result);
$i=0;
while($row=mysql_fetch_array($result)){
$id=$row['sectionID'];
$theFirst=$row['first'];
$theLast=$row['last'];
$theProject=$row['project'];
$theAmount=$row['amount'];
$Data.="&id" . $i . "=" . $id . "&theFirst" . $i . "=" . $theFirst . "&theLast" . $i . "=" . $theLast . "&theProject" . $i . "=" . $theProject . "&theAmount" . $i . "=" . $theAmount;
$i++;
}
$Data.='&numRows='.$numRows;
echo $Data;
?>
and here is the actionscript
function buildData(){
dataVars=new LoadVars();
dataVars.onLoad=function(ok){
if(ok){
for(i=0;i<this.numRows;i++){
first_txt.text+=this['theFirst'+i]+newline;
last_txt.text+=this['theLast'+i]+newline;
project_txt.text+=this['theProject'+i]+newline;
amount_txt.text+=this['theAmount'+i]+newline;
}
}else{
first_txt.text='error';
}
}
dataVars.load('data.php?pageid=1');
} buildData();
now if i put
dataVars.load('data.php?pageid=2');
on a button in flash it will load the next increment but i want it to do this on its own.
thanks for any help