Ver Mensaje Individual
  #25 (permalink)  
Antiguo 24/02/2009, 19:02
lauchalp95
 
Fecha de Ingreso: julio-2006
Mensajes: 254
Antigüedad: 17 años, 10 meses
Puntos: 0
Respuesta: Inventario en PHP (Denme una ideita)

Bien ahora mi problema es que quiero mostrar el inventrio del usuario-
Tengo.:
tabla objetos:
id
nombre
img
tabla relacion:
id_obj
id_usu
Y quiero que al ingresar a la pagina de inventario muestro los de uno, para eso hize este code:

Código PHP:
Ver original
  1. <?php
  2. # FileName="Connection_php_mysql.htm"
  3. # Type="MYSQL"
  4. # HTTP="true"
  5. $hostname_Noone = "X";
  6. $database_Noone = "X";
  7. $username_Noone = "X";
  8. $password_Noone = "X";
  9. $Noone = mysql_pconnect($hostname_Noone, $username_Noone, $password_Noone) or trigger_error(mysql_error(),E_USER_ERROR);
  10. ?>
  11. <?php
  12. if (!function_exists("GetSQLValueString")) {
  13. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  14. {
  15.   if (PHP_VERSION < 6) {
  16.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  17.   }
  18.  
  19.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  20.  
  21.   switch ($theType) {
  22.     case "text":
  23.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  24.       break;    
  25.     case "long":
  26.     case "int":
  27.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  28.       break;
  29.     case "double":
  30.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  31.       break;
  32.     case "date":
  33.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  34.       break;
  35.     case "defined":
  36.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  37.       break;
  38.   }
  39.   return $theValue;
  40. }
  41. }
  42.  
  43. $colname_usuarios = "-1";
  44. if (isset($_SESSION['MM_Username'])) {
  45.   $colname_usuarios = $_SESSION['MM_Username'];
  46. }
  47. mysql_select_db($database_Noone, $Noone);
  48. $query_usuarios = sprintf("SELECT id, usuario FROM usuarios WHERE usuario = %s", GetSQLValueString($colname_usuarios, "text"));
  49. $usuarios = mysql_query($query_usuarios, $Noone) or die(mysql_error());
  50. $row_usuarios = mysql_fetch_assoc($usuarios);
  51. $totalRows_usuarios = mysql_num_rows($usuarios);
  52.  
  53. mysql_select_db($database_Noone, $Noone);
  54. $query_objetos = "SELECT * FROM objetos";
  55. $objetos = mysql_query($query_objetos, $Noone) or die(mysql_error());
  56. $row_objetos = mysql_fetch_assoc($objetos);
  57. $totalRows_objetos = mysql_num_rows($objetos);
  58.  
  59. mysql_select_db($database_Noone, $Noone);
  60. $query_relacion = "SELECT * FROM inventario  WHERE id_u = $row_usuarios[id]  ORDER BY id_o ASC";
  61. $relacion = mysql_query($query_relacion, $Noone) or die(mysql_error());
  62. $row_relacion = mysql_fetch_assoc($relacion);
  63. $totalRows_relacion = mysql_num_rows($relacion);  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ?>
  71. <html>
  72. <table border="1">
  73.   <?php do { ?>
  74.     <tr>
  75.       <td><?php echo $row_relacion['id_o']; ?></td>
  76.     </tr>
  77.     <?php } while ($row_relacion = mysql_fetch_assoc($relacion)); ?>
  78. </table>
  79. </html>

Y asi , se me visualiza el ID del objeto.
Lo que yo quiero es que se visualize el nombre y su imagen