search sql database in flash via php return results to flash

  • stef.oshea
  • Born
  • Born
  • stef.oshea
  • Posts: 2

Post 3+ Months Ago

hi i'm havin problems sending info to the php wen i put in a trace the word(s) are sending but it seems wen on the server the info is not sending. i hav checked the server connections and everythin is ok so it must be my flash

what i am hoping to do is enter a word in flash. send it to a php file. from there query my database. wen the word matches a descripton in my database to return the associated result in flash

any help with code appericated

flash code:

on the send button i have:

on(release){

myDataOut = new LoadVars()
myDataOut.input =inputtextbox.text;
myDataOut.sendAndLoad("search.php",myDataOut,"POST")


}

on the actions layer i have:

myData = new LoadVars()
myData.ref = this;
myData.onLoad = function(){
if(this.writing=="Ok") {
for(var i=0;i< rows;i++){
dynamictext.htmlText = "<b>"+"description: "+"</b>"+this["description"+i]+"<br>"+"<b>"+"url: "+"</b>"+this["url"+i]+"<br>";
}
} else { //if "writing" did not equal "Ok"
dynamictext.text=("no working");
}
}

note: everything is on one frame on the timeline

my php script looks like this :

<?
$description=$_GET["input"];
$dbh=mysql_connect ("localhost", "*******f", "********") or die ('I cannot connect to the database because: ' .mysql_error());
mysql_select_db ("**********");
$result = mysql_query("SELECT * FROM delicious where 'description= $description'") or die(mysql_error());
$rows = 0;
while($row=mysql_fetch_array($result)){
echo $description;
$rows= $row['description'];

$rows++; //increment our row count

echo $row['description']."".$row['url'];
if($result) echo "&writing=Ok&";
}
?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>search</title>
</head>
<body bgcolor="#000000">
<!--url's used in the movie-->
<!--text used in the movie-->
<!--
<p align="left"></p>
-->
<!-- saved from url=(0013)about:internet -->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="550" height="400" id="search" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="search.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><embed src="search.swf" quality="high" bgcolor="#000000" width="550" height="400" name="search" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

i think you missused the sendAndLoad method.
you should have something like:
Code: [ Select ]
on(release){

myDataOut = new LoadVars();
myData = new LoadVars();
myDataOut.input =inputtextbox.text;
myDataOut.sendAndLoad("search.php",myData ,"POST");

myData.onLoad = function()
{

if(myData.writing=="Ok")
{

for(var i=0;i< rows;i++)
{


// either use myData[...] or use this[...] ... see how it works
dynamictext.htmlText = "<b>"+"description: "+"</b>"+myData["description"+i]+"<br>"+"<b>"+"url: "+"</b>"+myData["url"+i]+"<br>";

}

}
else
{ //if "writing" did not equal "Ok"

dynamictext.text=("no working");

}

}

}
  1. on(release){
  2. myDataOut = new LoadVars();
  3. myData = new LoadVars();
  4. myDataOut.input =inputtextbox.text;
  5. myDataOut.sendAndLoad("search.php",myData ,"POST");
  6. myData.onLoad = function()
  7. {
  8. if(myData.writing=="Ok")
  9. {
  10. for(var i=0;i< rows;i++)
  11. {
  12. // either use myData[...] or use this[...] ... see how it works
  13. dynamictext.htmlText = "<b>"+"description: "+"</b>"+myData["description"+i]+"<br>"+"<b>"+"url: "+"</b>"+myData["url"+i]+"<br>";
  14. }
  15. }
  16. else
  17. { //if "writing" did not equal "Ok"
  18. dynamictext.text=("no working");
  19. }
  20. }
  21. }
  • stef.oshea
  • Born
  • Born
  • stef.oshea
  • Posts: 2

Post 3+ Months Ago

cheers sori bout d late reply my internet was actin up ! it didnt seem to work so im opting for anther type of search thanks all the same tho!

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 10 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.