[PHP/mySQL] Different resultat d'une equete SQL entre PHP / phpMyAdmin

Different resultat d'une equete SQL entre PHP / phpMyAdmin [PHP/mySQL] - SQL/NoSQL - Programmation

Marsh Posté le 10-05-2009 à 09:39:21    

Bonjour,
 
Je suis perplexe devant le probleme suivant:
 
J'ai une requete que j'execute dans un code php qui ne retourne pas ce que je souhaite.
--> Quand je fais un 'echo($req)' juste apres je retrouve la requete que je colle dans phpMyadmin et je retrouve alors le resultat attendu !!
 
Ci-dessous le code incrimine:

 $req="SELECT equipments_asset_code AS acc, CONCAT('-', REPLACE('".$all_ac."', equipments_asset_code, '') ,'-') AS actions FROM equipments, manufacturers, locations, status WHERE equipments_manufacturer=manufacturers_ID AND equipments_location=locations_ID AND equipments_status=status_ID ".$where." ORDER BY equipments_ID ASC;";
 
  echo $req."\n<br/>";
  $result=mysql_query($req);
  $myrow = mysql_fetch_row($result);
  echo "<pre>";
  print_r($myrow);
  echo "</pre>";


Voici la requete renvoyee par echo:

SELECT equipments_asset_code AS acc, CONCAT('-', REPLACE('A06G000811|A05G900505|A05G900503|A05G900507|', equipments_asset_code, '') ,'-') AS actions FROM equipments, manufacturers, locations, status WHERE equipments_manufacturer=manufacturers_ID AND equipments_location=locations_ID AND equipments_status=status_ID  AND equipments_asset_code IN ('A06G000811', 'A05G900505', 'A05G900503', 'A05G900507') ORDER BY equipments_ID ASC;


Voici le premier resultat php

(
    [0] => A06G000811
    [1] => -|A05G900505|A05
)


Voici ce que j'attends et ce que me renvoie phpMyadmin quand je colle la requete SQL (en gros de supprimer l'asset_code de la chaine de caractere)

   [0] => A06G000811
    [1] => -|A05G900505|A05G900503|A05G900507|-

Reply

Marsh Posté le 10-05-2009 à 09:39:21   

Reply

Marsh Posté le 13-05-2009 à 12:38:07    

peu de succes avec ces laitages :(

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed