# \[MX04\] AS problem (loading variables from PHP), probably syntax

**URL:** <https://forum.kirupa.com/t/mx04-as-problem-loading-variables-from-php-probably-syntax/168054>\
**Category:** Uncategorized\
**Created:** [November 3, 2005, 3:24pm UTC](https://forum.kirupa.com/t/mx04-as-problem-loading-variables-from-php-probably-syntax/168054 "2005-11-03T15:24:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dennuzz](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@dennuzz](https://forum.kirupa.com/u/dennuzz)\
**Post date:** [November 3, 2005, 3:24pm UTC](https://forum.kirupa.com/t/mx04-as-problem-loading-variables-from-php-probably-syntax/168054/1 "2005-11-03T15:24:58Z")

</div>

I have the following AS code attached to a movieclip:

```auto
onClipEvent (load) {
loadVariables("[http://localhost/flashvars.php](http://localhost/flashvars.php)", this, "GET");
 
if (daylight==1) { //daylight
	this.gotoAndStop(1);
	this._parent.sky.gotoAndStop(1);
	this._parent.lights.gotoAndStop(1); 
} else if (daylight==0) { //night
	this.gotoAndStop(5);
	this._parent.sky.gotoAndStop(5);
	this._parent.lights.gotoAndStop(5); 
}
}

```

The variable _daylight_ comes from this PHP-script:

```php
<?
$hour = date("H");
if ($hour >= 18 OR $hour < 7) { // night
$daylight = '0';
} else { // daylight
$daylight = '1';
}
echo "daylight=$daylight";
?>

```

With the var _daylight_ set to ‘0’ or ‘1’, a couple of mc’s (‘sky’,‘lights’) are told to jump to frame 1 or 5, but it seems that my if-loop doesn’t work well. I placed a dynamic textfield in this same mc which displays the var directly from the PHP-script to see if the var is imported correctly and that works fine. I hope I made myself clear, does somebody know what I’m doing wrong?
