Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem loading correct url using getURL

Status
Not open for further replies.

Edward07

Programmer
Apr 13, 2007
49
NL
I want to use dyanamic url for getURL. i get the dynamic url from script.php via echo "url=$url"; The url reaches
the flash corectly since i checked it with trace.url. But the problem is that getURL does not load the url. Instead it loads localhost/undefined.Could any one look at this code and let me know how to fix it.Thanks


Code:
myData = new LoadVars() 
        myData.ref = this 
        myData.load("[URL unfurl="true"]http://localhost/script.php")[/URL]
        myData.onLoad = function(succes){ 
            if(succes){ 
			
getURL ("javascript:NewWindow=window.open(this.url,'newWin','
width=400,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus();      void(0);");

           trace(this.url);
            } else trace("Error loading data")
			
        } 

}
 
well you an unneeded } at the end that will cause error for sure

if thats not all then maybe 'this.url' will help

 
i forget to delete that { when posting here.Because this funciton was part of another function called every few seconds. I tried all these and non worked

this.url
+this.url+
'+this.url+'
"+this.url+"

all of them failed!!!

error:

Insternet Explorer cannot downoad.

Unspecified error
 
I am getting the url from php script so i have to use this.url . Is there any better way?
 
i think the problem is with passing data from php to flash
i keep getting this error:
Error loading data

I checked the php it outputs the url corectly but itseem
it is not getting passed to flsh for some reason!!

Here is the php part:

Code:
<?


$server   = "localhost"; // MySQL hostname
$username = "root"; // MySQL username
$password = ""; // MySQL password
$dbname   = "db"; // MySQL db name


$db = mysql_connect($server, $username, $password) or die(mysql_error());
      mysql_select_db($dbname) or die(mysql_error());


 $query2 = "SELECT url FROM table WHERE ID ='2' ";
          
            $result2 = mysql_query( $query2 );

            $fp = fopen("log", "w");
            fwrite($fp, $query);
            fclose($fp);

           if(mysql_num_rows( $result2 ) ) 
           {
                 $row = mysql_fetch_array( $result2 );

               outputURL($row['url']);

           }
           else
           {

              echo "url=Empty url";

           }

function outputURL($url)
{
    echo "url=$url";


    
}

?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top