doudi8231 2013-08-12 09:38
浏览 312

flex 4:HTTP请求不发送值

Im making a small project in flex. The user can look up bookreviews. When types in the name of the book i get all the reviews back instead of the reviews of that particular book.

my code:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="" 
           xmlns:mx="library://" minWidth="955" minHeight="600"


        public function handleMenu(event:ResultEvent):void{
            DescrBooks.dataProvider =;
        public function Start():void{


        public function ShowBooks(SelectedBooks:Object):String{
            var descr:String = SelectedBooks.itemDesc;

            var D:String = descr

            return D;   

    <!-- Place non-visual elements (e.g., services, value objects) here     


    <s:HTTPService id="favorieten" 
                   url="" method="POST"
        <s:request xmlns="" >


<mx:VBox x="14" y="60" width="744" height="450">
    <mx:Repeater id="DescrBooks" maxWidth="450">

            <mx:Text text="{ShowBooks(DescrBooks.currentItem)}" maxWidth="450" />

<s:Button x="14" y="25" label="Button" click="Start()"/>
<s:TextInput x="92" y="25" id="TextTI"/>

My php script:

header("Content-type: text/xml");
header("Expires: Mon, 26 Jul 1990 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// cache wordt uitgeschakeld om zeker te zijn dat de gegevens uit de API gelezen worden en niet uit de cache van de webbrowser
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
//alle gegevens om connectie te leggen naar de databank
    $host = "";
    $user = "*********";
    $pass = "*********";
    $database = "gertjanvanhove2012";
//connectie leggen naar de databank
$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");
mysql_select_db($database, $linkID) or die("Could not find database.");
//gegevens gaan halen uit de databank

$query = "SELECT * FROM RMA_Review ";


$_GET['voorwerp'] = $tit;
$query = "SELECT * FROM RMA_Review where Title='".$tit."'";
$menu_result = mysql_query($query, $linkID) or die("Data not found.");
//starten met de opbouw van de string die de XML code bevat
$xml_output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
$xml_output .= "<menu>
//voor elk menu item de nodige gegevens neerschrijven
for($x = 0 ; $x < mysql_num_rows($menu_result) ; $x++){
$itemrow = mysql_fetch_assoc($menu_result);
$xml_output .= "\t<menuitem>
$xml_output .= "\t\t<itemID>" . $itemrow['ReviewId'] . "</itemID>
$xml_output .= "\t\t<itemLabel>" . $itemrow['Title'] . "</itemLabel>
$xml_output .= "\t\t<itemDesc>" . $itemrow['Review'] . "</itemDesc>
$xml_output .= "\t\t<itemAutheur>" . $itemrow['Autheur'] . "</itemAutheur>
$xml_output .= "\t</menuitem>
$xml_output .= "</menu>
//de volledige XML string in de response echo'n
echo $xml_output;?>

the table RMA_Reviews looks like this: (cant post a screenshot because i dont have enough rep)

So My question is: how can I only show the values of the Books that u typed in the textfield.

  • 写回答

1条回答 默认 最新

  • douan9541 2013-08-12 10:24

    Seems to me, you don't pass the 'title' variable to your php-script.

    Try adding it via URLVariables as illustrated in this example:

    EDIT: OOPS, sorry, I guess you do! Overread it in the code above... Can you confirm the variable is passed in the php as it should be?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办