Connection a MySql avec flex 4

doudou -  
 debutantflex2011 -
Bonjour,
J'essaye de me connecter à ma base de données MySql à partir de Flex 4 mais je n'y arrive pas. Auriez vous une solution ? je suis ces indications la : http://www.sephiroth.it/tutorials/flashPHP/as3flexdb/

Mais l'execution j'ai une erreur m'indiquant : Error: A connection with the same name exist!
Alors que pas du tout.

Merci d'avance (je suis sur Mac et j'utilise mamp)

2 réponses

  1. koforever Messages postés 11 Statut Membre 2
     
    salut ,
    ta reponse est ici : http://social.hecube.net/blog/2009/05/05/flex-amfphp-connecter-un-service-amfphp-a-une-application-flex/
    0
  2. mitchlmx
     
    Salut,
    j'ai le même problème que toi, as tu trouvé la solution ?
    Merci
    0
    1. aicha
       
      moi aussi jai le meme probleme
      0
    2. debutantflex2011
       
      pour la connexion :

      <?php
      $db_host = "localhost";
      $db_user = "root";
      $db_pwd = "root";
      $db_name = "xxxx";
      mysql_connect($db_host, $db_user, $db_pwd);
      mysql_select_db($db_name) or die( "Erreur de connexion a la base de donnees");
      ?>
      0
    3. debutantflex2011
       
      <?PHP
      ini_set('display_errors', "1");
      ini_set('error_reporting', E_ALL ^ E_NOTICE);
      header("Content-type: text/xml");

      //Connect to Database
      include 'dbconnect.php';

      $linkID = mysql_connect($db_host, $db_user, $db_pwd) or die("Impossible de se connecter a la base de donnees");
      mysql_select_db($db_name, $linkID) or die("Base de donnees inexistante");

      $query = "SELECT * FROM fabricant ORDER BY fabricant_id DESC";
      $resultID = mysql_query($query, $linkID) or die("Donnees pas trouves");

      $xml_output = "<?xml version='1.0' encoding='utf-8'?>\n";
      $xml_output .= "<fabricants>\n";


      for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
      $row = mysql_fetch_assoc($resultID);
      $xml_output .= "\t<fabricant>\n";


      // Escaping illegal characters
      $row['text'] = str_replace("&", "&", $row['text']);
      $row['text'] = str_replace("<", "<", $row['text']);
      $row['text'] = str_replace(">", ">", $row['text']);
      $row['text'] = str_replace("\"", """, $row['text']);


      $xml_output .= "\t\t<fabricant_id>" . $row['fabricant_id'] . "</fabricant_id>\n";
      $xml_output .= "\t\t<fabricant_nom>" . $row['fabricant_nom'] . "</fabricant_nom>\n";
      $xml_output .= "\t\t<fabricant_image>" . $row['fabricant_image'] . "</fabricant_image>\n";
      $xml_output .= "\t\t<fabricant_web>" . $row['fabricant_web'] . "</fabricant_web>\n";
      $xml_output .= "\t\t<fabricant_email>" . $row['fabricant_email'] . "</fabricant_email>\n";



      $xml_output .= "\t</fabricant>\n";
      }

      $xml_output .= "</fabricants>";

      echo $xml_output;

      ?>
      0
    4. debutantflex2011
       
      coté flex :

      <s:HTTPService id="fabricant_select" url="http://localhost:8888/tondossier/bin-debug/fabricant_select.php" useProxy="false" />
      <s:HTTPService id="serv" url="http://localhost:8888/tondossier/bin-debug/fabricant_select.php" fault="serv_faultHandler(event)" result="serv_resultHandler(event)"/>
      0
    5. debutantflex2011
       
      Après tu lie tous ça a ton datagrid ou autres, je suis debutant si quelqu'un a meilleure façon d'y faire j'achète volontier. en esperant t'avoir aider.
      salutation.

      A+
      Shyam.L
      0