# Php preload & duplicate

**URL:** https://forum.kirupa.com/t/php-preload-duplicate/116522
**Category:** Uncategorized
**Created:** [July 19, 2004, 6:16am UTC](https://forum.kirupa.com/t/php-preload-duplicate/116522 "2004-07-19T06:16:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ndamofli](https://avatars.discourse-cdn.com/v4/letter/n/a87d85/32.png) [@ndamofli](https://forum.kirupa.com/u/ndamofli)
#### Post date: [July 19, 2004, 6:16am UTC](https://forum.kirupa.com/t/php-preload-duplicate/116522/1 "2004-07-19T06:16:57Z")

</div>

I’ve been working on a news manager and i have some difficulties.  
First of all i would like to know if there is a way to preload variables from my php script.

In addition, i want to use three identical sets of movieclips without having to load the vars individually for each set ex.  
\_root.holder.loadVariables(“[http://www.damofli.com/news/fetch\_categories\_and\_news.php?id=1](http://www.damofli.com/news/fetch_categories_and_news.php?id=1)”);  
\_root.holder2.loadVariables(“[http://www.damofli.com/news/fetch\_categories\_and\_news.php?id=1](http://www.damofli.com/news/fetch_categories_and_news.php?id=1)”);  
\_root.holder3.loadVariables([http://www.damofli.com/news/fetch\_categories\_and\_news.php?id=1](http://www.damofli.com/news/fetch_categories_and_news.php?id=1));

Actionscript for the holder moviclip:  
onClipEvent (data) {  
for (i=0; i\<new\_count; i++) {  
_root.holder2.dp.duplicateMovieClip(“nn”+i, i+200);  
eval(“nn”+i).aid = eval("new\_id_" add i);  
eval(“nn”+i).ana = eval(“new\_name\_” add i);  
\_root.holder2[“nn”+i].\_y = (i-1)\*150;  
new\_image.\_visible = 1;  
new\_scrollbar.\_visible = 1;  
new\_instructions\_object.text = new\_instructions;  
}  
}

PHP script  
\<?  
require (“db.inc”);  
$DB = new Database;

if ($search) {  
$query = "SELECT id, name FROM news " .  
“WHERE MATCH (name, author, instructions) AGAINST (” .  
$DB-\>quote($search) . “)”;  
} else {

$query = "SELECT news.id, news.name " .  
"FROM news, new\_category\_xref AS xref " .  
“WHERE news.id=xref.new\_id " .  
“AND xref.category\_id=” . $DB-\>quote($id) .  
" ORDER BY news.name”;  
}  
$result = $DB-\>query($query);

$i = 0;  
while (list($news\_id, $news\_name) = mysql\_fetch\_row($result)) {  
echo “new\_id\_” . $i . “=” . $news\_id . “&”;  
echo “new\_name\_” . $i . “=” . urlencode($news\_name) . “&”;  
$i++;  
}  
echo “new\_count=” . $i . “&”;  
mysql\_free\_result ($result);

if ($search) {  
echo “cat\_count=0&”;  
$id = 0;  
} else {  
$query = “SELECT id, name FROM categories " .  
“WHERE parent\_id=” . $DB-\>quote($id) .  
" ORDER BY name”;  
$result = $DB-\>query($query);  
$i = 0;  
while (list($cat\_id, $cat\_name) =  
mysql\_fetch\_row($result)) {  
echo “cat\_id\_” . $i . “=” . $cat\_id . “&”;  
echo “cat\_name\_” . $i . “=” . urlencode($cat\_name) .  
“&”;  
$i++;  
}  
echo “cat\_count=” . $i . “&”;  
}

if ($id==0) {  
echo “parent\_id=0&category\_name=” .  
urlencode($cookbook\_name);  
} else {  
$query = “SELECT parent\_id, name FROM categories WHERE id=” . $DB-\>quote($id);  
$result = $DB-\>query($query);  
$i = 0;  
list($cat\_id, $cat\_name) = mysql\_fetch\_row($result);  
echo “parent\_id=” . $cat\_id . “&”;  
echo “category\_name=” . urlencode($cookbook\_name .  
": " . $cat\_name);  
}  
?\>

Thanx in advance
