Quantcast
Channel: Adobe Community : All Content - Adobe Animate CC - General
Viewing all articles
Browse latest Browse all 13519

how to make a button to search something in sql

$
0
0

I am trying to make a button that can search for something like for example if like say i type yes, it will show me things that is under yes.But I am not sure how to make the code work as I cannot change the php code as it is under the requirement that I make the button work and not using the php code to make it work which means that I cannot type the yes to show the information and the button must somehow have the "yes" in the function to show the information.Please help me and Thanks for your help.

This is my flash code.

package  {

 

  import flash.display.MovieClip;

  import flash.net.NetConnection;

  import flash.net.Responder;

  import flash.events.MouseEvent;

 

  public class main extends MovieClip {

 

  var gateway:NetConnection;

  var responder:Responder;

 

  public function main() {

 

  gateway = new NetConnection();

  gateway.connect("http://localhost:8088/amfphp/gateway.php");

  responder = new Responder(OnPass,OnError);

 

  showAlBtn.addEventListener(MouseEvent.CLICK,doAvailable);

  }

 

  function doAvailable(evt:MouseEvent):void

  {

  gateway.call("Books.getBooksAvailable",responder);

 

  }

  function OnPass(res:Object):void

  {

   var i:int;

 

  albumDG.removeAll();

  for (i=0;i<res.length;i++)

  {

  albumDG.addItem(res[i]);

  }

 

  }

  function OnError(res:Object):void

  {

  trace("Error");

  }

  }

 

}

 

 

 

.This is the code for the php code that works because I already tested it out because it allows me to type yes and it shows me the required information that I need and it is not tested on flash cs6 but on local host things that allows me to test it out.

function getBooksAvailable($avail)

  {

  $this->connect();

  $sql = "SELECT title as 'Book Title', author as 'Author', price as 'Price', available as 'Available'

  FROM tblbookinventory

  WHERE available ='" . $avail . "'";

  $result = mysql_query($sql, $this->_connection);

  $rows = array();

  while($row = mysql_fetch_array($result, MYSQL_ASSOC))

  {

  array_push($rows, $row);

  }

  return $rows;

  }


Viewing all articles
Browse latest Browse all 13519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>