-
Site search using MySQL
I am working on a property website which will have a property search on it. The list of properties is stored on MySQL database. For now i only need to retrieve the Description of the property (300 chars).
I would like to find out how to retrieve the results from the MySQL into flash using a php script.
To list results in flash I was thinking to use a script to duplicate a MC which has a single Dynamic text field in it. The number duplications would be the same as the number of returned results.
b = "number_of_resuts";
yposs = 30;
for (a=0; a<=b; a++) {
duplicateMovieClip(_root.Results, "Result"+a, a);
setProperty("_root.Result"+a, _y, yposs);
yposs = yposs+30;
}
And then use a script to store the returned results in each textbox.
i.e.
for (i=0; i<=b; i++) {
tellTarget (eval("Result"+i)) {
text_box_variableName = "hello" +/:i;
}
}
Can someone plz tell me if this would work and help me out with php script.
THX...
-
Hi,
you are pretty close...
Some slight changes:
b = Number(number_of_results);
The Number function ensures you are dealing with a number rather than a string made up of digits
Code:
for(a = 0 ; a < b ; a++)
{ duplicateMovieClip(_root.Results, "Result"+a, a+1);
Your code produces one extra clip - also you cannot put them to depth 0
_root["Result"+a].textboxname = this["hello"+i];
The matching mysql/php would be
Code:
$count = 0;
$result = mysql_query("select hello from tablename where ....");
while($row = mysql_fetch_array())
{ print "&hello$count=" . $row["hello"];
$count++;
}
print "&number_of_results=$count";
-
Thx for the reply.
Could you or someone plz explain to me the retrival of data into an array in flash.
Thx. Ged
-
Code:
for(j = 0 ; j < Number(number_of_results) j++)
myarray[j] = this["hello"+j]
Musicman
-
any chance of sending me a simple php script which sends an array and the FLA which displays it.
thx. Ged
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|