Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-29-2005, 02:51 PM   #1
Xman51
Freedom Fighter
 
Xman51's Avatar
 
Join Date: Apr 2005
Location: wwwroot
Posts: 93
Send a message via AIM to Xman51
Angry Issue with Loadvar: php timeout...?!!?[Resolved]

Hello All,

I am having an issue with my php timing out, I don't understand why. I have made this type of adodb connection string before and it worked fine.

Here is my AS:

ActionScript Code:
var DrawnArr:Array = new Array(); function checkValue(val:Number,arr:Array):Boolean{      for(var i=0;i<arr.length;i++){           if(arr[i]==val){                return true;           }      }      return false; } //================================= //  INIT //================================= var path = "http://localhost/kikaijin/";                //declare path to php files var lvOut = new LoadVars();               //create lv object var lvIn = new LoadVars();                //create lv object lvIn.onLoad = function (success) {         if(success){                 //PHP variable value to textbox                 cName.text =        lvIn.retCN;                 cType.text =        lvIn.retCT;                 cSubType.text =     lvIn.retST;                 cMicroType.text =   lvIn.retMT;                 cDescription.text = lvIn.retCD;                 cPower.text =       lvIn.retCP;                 cLevel.text =       lvIn.retCL;                         }else{                 //...or notify of failure                 cName.text =       "fail";                 cType.text =        "fail";                 cSubType.text =     "fail";                 cMicroType.text =   "fail";                 cDescription.text = "fail";                 cPower.text =       "fail";                 cLevel.text =       "fail";         } } //================================= //  BTN //================================= myBtn.onRelease = function(){         //for (var i=0; i<6; i++){             suit1 = Math.random() * 4;             suit1 = int(suit1)+1;             face1 = Math.random() * 13;             face1 = int(face1)+1;             card1 = ((suit1 - 1) * 13)+face1;             tocard1 = card1+1;             //trace(tocard1);                             lvOut.ID = tocard1;                 trace(lvOut.ID);                 lvOut.sendAndLoad(path + "draw.php", lvIn, "POST");                         DrawnArr.push(tocard1);         //}         };

Here is my php:

PHP Code:
<?
$cardID
$_POST['ID'];

$conn = new COM("ADODB.Connection") or die("Cannot start ADO"); 

// Microsoft Access connection string.
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\\phpdev\\www\\kikaijin\\Cards.mdb");

// SQL statement to build recordset.
$rs $conn->Execute("SELECT * FROM List WHERE ID=$CardID;");

// Display all the values in the records set
while (!$rs->EOF) { 
        
$cardN $rs->Fields("cName");
    
$cardT $rs->Fields("cType");
    
$cSubT $rs->Fields("cSubType");
    
$cMicr $rs->Fields("cMicroType");
    
$cDesc $rs->Fields("cDescription");
    
$Power $rs->Fields("cPower");
    
$Level $rs->Fields("cLevel");

$rs->Close(); 

echo 
"&retCN=$cardN";
echo 
"&retCT=$cardT";
echo 
"&retST=$cSubT";
echo 
"&retMT=$cMicr";
echo 
"&retCD=$cDesc";
echo 
"&retCP=$Power";
echo 
"&retCL=$Level";

?>
It took a monumental amount of time to load the return values in my movie and when it did it returned the value "undefined" in every field. So I checked the php itself on my localhost and replaced the value of $cardID with the value "3" and it gave me the following output:

Quote:
Fatal error: Maximum execution time of 30 seconds exceeded in c:\phpdev\www\kikaijin\draw.php on line 17
Does anyone see the error in my logic...I have gone over the code 1000 times and I don't see it.

Thanks in Advance,

Xman51

Last edited by Xman51; 07-01-2005 at 06:55 PM. Reason: [Resolved]
Xman51 is offline   Reply With Quote
Old 06-30-2005, 01:43 PM   #2
Xman51
Freedom Fighter
 
Xman51's Avatar
 
Join Date: Apr 2005
Location: wwwroot
Posts: 93
Send a message via AIM to Xman51
Angry

OK, now my AS Code looks like this:

ActionScript Code:
stop(); var DrawnArr:Array = new Array(); function checkValue(val:Number,arr:Array):Boolean{      for(var i=0;i<arr.length;i++){           if(arr[i]==val){                return true;           }      }      return false; } //================================= //  INIT //================================= var path = "http://localhost/kikaijin/";                //declare path to php files var lvOut = new LoadVars();               //create lv object var lvIn = new LoadVars();                //create lv object lvIn.onLoad = function (success) {         if(success){                 //PHP variable value to textbox                     GetBack();                                         cName.text =        lvIn.retCN;                     cSubType.text =     lvIn.retST;                     cMicroType.text =   lvIn.retMT;                     cDescription.text = lvIn.retCD;                     cPower.text =       lvIn.retCP;                     cLevel.text =       lvIn.retCL;                         }else{                 //...or notify of failure                     cName.text =        "fail";                     cType.text =        "fail";                     cSubType.text =     "fail";                     cMicroType.text =   "fail";                     cDescription.text = "fail";                     cPower.text =       "fail";                     cLevel.text =       "fail";         } } //================================= function GetCard(){             //cleanText()             suit1 = Math.random() * 5;             suit1 = int(suit1)+1;             face1 = Math.random() * 9;             face1 = int(face1)+1;             card1 = ((suit1 - 1) * 9)+face1;             tocard1 = card1+1;             trace(tocard1);             lvOut.ID = tocard1;             lvOut.dType = "Spell";             lvOut.sendAndLoad(path + "draw1.php", lvIn, "POST");             DrawnArr.push(tocard1);         //}         }; function cleanText(){                     cName.text =        "";                     cType.text =        "";                     cSubType.text =     "";                     cMicroType.text =   "";                     cDescription.text = "";                     cPower.text =       "";                     cLevel.text =       ""; } function backload(clip) {         back_container.loadMovie(clip);         var temp = this.createEmptyMovieClip("tmp", 999); } function GetBack(){     var cType = lvIn.retCT;     trace(cType);         if(cType=="Spell"){         backload("deck/Spell.swf");     }     if(cType=="Combat"){         backload("deck/Combat.swf");     }     if(cType=="Item"){         backload("deck/Item.swf");     }     if(cType=="Feat"){         backload("deck/Feat.swf");     }     if(cType=="Skill"){         backload("deck/Skill.swf");     }     if(cType==undefined){         backload("deck/CardFace.swf");     } } GetCard();

and my php code looks like this:

PHP Code:
<?

//get the value posted from Flash
$cardID$_POST['ID'];
$DeckID$_POST['dType'];

//Open the connection
$conn=odbc_connect('Deck','xman51','area51'); 
if (!
$conn)
{
exit(
"Connection Failed: " $conn); 

$sql="SELECT * FROM $DeckID WHERE ID=$CardID;";

//echo $sql;
$rs=odbc_exec($conn$sql);

$Colnum=odbc_num_fields($rs); 

    while(
odbc_fetch_into($rs,&$Str))

    { 

      for(
$i=0;$i<$Colnum;$i++) 

      {
    
$cardN $Str[1];
    
$cardT $Str[2];
    
$cSubT $Str[3];
    
$cMicr $Str[4];
    
$cDesc $Str[5];
    
$Power $Str[6];
    
$Level $Str[7];
       }

    echo 
"&retCN=$cardN";
    echo 
"&retCT=$cardT";
    echo 
"&retST=$cSubT";
    echo 
"&retMT=$cMicr";
    echo 
"&retCD=$cDesc";
    echo 
"&retCP=$Power";
    echo 
"&retCL=$Level";
    }



if (!
$rs)

exit(
"Error in SQL");


?>
I got it to work perfectly yesterday, it was populating the text fields and everything, but it appears tht the $DeckID variable is mucking it all up and I don't know why? It keeps bringing everything back as undefined... anybody have an idea?

Thanks in advance,

Xman51
Xman51 is offline   Reply With Quote
Old 07-01-2005, 11:58 AM   #3
Xman51
Freedom Fighter
 
Xman51's Avatar
 
Join Date: Apr 2005
Location: wwwroot
Posts: 93
Send a message via AIM to Xman51
Default

Can anyone please assist me?
Xman51 is offline   Reply With Quote
Old 07-01-2005, 06:56 PM   #4
Xman51
Freedom Fighter
 
Xman51's Avatar
 
Join Date: Apr 2005
Location: wwwroot
Posts: 93
Send a message via AIM to Xman51
Default

Resolution: In the sql statement the variable "$cardID" was spelled with a capital "C" thereby screwing up the sql statement.
Xman51 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:43 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.