Ver Mensaje Individual
  #6 (permalink)  
Antiguo 27/06/2011, 17:18
privatefta
(Desactivado)
 
Fecha de Ingreso: septiembre-2010
Mensajes: 498
Antigüedad: 13 años, 8 meses
Puntos: 5
Respuesta: duda con buscar datos de dos tabla bd

Mira creo que así como lo tengo creo que tiene que mostrar los datos pero no muestra los resultados

Código PHP:
Ver original
  1. <?php
  2.  
  3. $dbhost = "localhost";
  4. $dbname = "test";
  5. $dbuser = "test";
  6. $dbpass = "test";
  7. $charset = "utf-8";
  8.  
  9. $conn = @mysql_connect($dbhost,$dbuser,$dbpass) or die ("ERROR! No connection to database!");
  10. mysql_select_db($dbname, $conn);
  11. $sql = mysql_query("SELECT * FROM usuarios WHERE Suspender='0' AND Baneado='0' AND Baja='0' ORDER BY IDUsuario ASC");
  12.        
  13. header("Content-type: text/xml; charset=".$charset);
  14. print("<xml-user-manager ver=\"1.0\">\n");
  15. while($line=mysql_fetch_array($sql)) {
  16.     if ($_Suspender == "1") {
  17.         $status = "1";
  18.         $_EnabledCambios = "false";
  19.     } else {
  20.         $status = "0";
  21.         $_EnabledCambios = "true";
  22.     }
  23.     if ($_Baneado == "1") {
  24.         $status = "1";
  25.         $_EnabledCambios = "false";
  26.     } else {
  27.         $status = "0";
  28.         $_EnabledCambios = "true";
  29.     }
  30.     if ($_Baja == "1") {
  31.         $status = "1";
  32.         $_EnabledCambios = "false";
  33.     } else {
  34.         $status = "0";
  35.         $_EnabledCambios = "true";
  36.     }
  37.     if ($line["Clave"] == "") {
  38.         $name = "";
  39.     } else {
  40.         $name = "name=\"".$line["Clave"]."\" ";
  41.     }
  42.    
  43.     if ($line["Password"] == "") {
  44.         $password = "";
  45.     } else {
  46.         $password = "password=\"".$line["Password"]."\" ";
  47.     }
  48.    
  49.     if ($line["Usuario"] == "") {
  50.         $displayname = "";
  51.     } else {
  52.         $displayname= "display-name=\"".$line["Usuario"]."\" ";
  53.     }
  54.    
  55.     if ($line["IDPlataforma"] == "") {
  56.         $profiles = "";
  57.     } else {
  58.         $dbprof = unserialize($line["IDPlataforma"]);
  59.         if ($dbprof <> "") {
  60.             $profDescrip = "";
  61.             foreach($dbprof as $printprof) {
  62.                 $sql2 = mysql_query("SELECT * FROM plataforma WHERE IDPlataforma='".$printprof."'");
  63.                 $profPlata=mysql_fetch_array($sql2);
  64.                     $profDescrip = $profDescrip.$profPlata["Descripcion"]." ";
  65.             }
  66.             $profiles = "profiles=\"".$profDescrip."\" ";
  67.             $dbprof = "";
  68.             $printprof = "";
  69.             $profDescrip = "";
  70.         } else {
  71.             $profiles = "";
  72.         }
  73.     }
  74.    
  75.     if ($line["maxconnections"] == "") {
  76.         $maxconnections = "";
  77.     } else {
  78.         $maxconnections = "max-connections=\"".$line["maxconnections"]."\" ";
  79.     }
  80.    
  81.     if ($line["Suspender"] == "") {
  82.         $enabled = "";
  83.     } else {
  84.         $enabled = "enabled=\"".$_EnabledCambios."\" ";
  85.     }
  86.    
  87.     print("<user ".$name.$password.$displayname.$profiles.$maxconnections.$enabled."/>\n");
  88. }
  89. print("</xml-user-manager>");
  90. mysql_close($conn);
  91. ?>