Advertisement

08.20.2008 at 03:15PM PDT, ID: 23664977
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.6

Php and MySQL  - Error Resource id #3

Asked by lanmex in PHP and Databases, PHP Scripting Language, MySQL Server

Tags: ,

Hi experts,
I'm using a php form to insert some fields in my database, on the form there are 7 fields, two of those are list/menu items, the problem is that these two items doesn't put the information I choose, it put "Resource id 3" insted.

here's my code, please help.
<?
session_start();
?>

<HTML>
<BODY bgcolor="#E6E6E6">
<?

//----------------------------------------------------------
//Inicialización de variables.
$DBhost = "999.999.9.999";
$DBuser = "test";
$DBpass = "";
$DBName = "test";
$table = "documentos";
//----------------------------------------------------------
      $db = mysql_connect($DBhost,$DBuser,$DBpass) or die("No fué posible conectarse con la Base de Datos.");
      //-------------------------------------------------------------------------------------
      @mysql_select_db("$DBName",$db) or die("Unable to select database $DBName");
      @$sql = "SELECT username FROM users";
      $usuario = mysql_query($sql);
      //-------------------------------------------
      @mysql_select_db("$DBName",$db) or die("Unable to select database $DBName");
      @$sql = "SELECT departamento FROM deptos";
      $departamento = mysql_query($sql);
      //-------------------------------------------
      //-------------------------------------------
      @mysql_select_db("$DBName",$db) or die("Unable to select database $DBName");
      @$sql = "SELECT tipo FROM tipo";
      $tipo = mysql_query($sql);
      //-------------------------------------------
      //-------------------------------------------
      @mysql_select_db("$DBName",$db) or die("Unable to select database $DBName");
      @$sql = "SELECT perioricidad FROM perioricidad";
      $perioricidad = mysql_query($sql);
      //-------------------------------------------
                        
?>
<br>
<html>
      <body background="bgpie.jpg">
<div align="center">
  <table width="60%" border="1" cellspacing="0" cellpadding="0">
    <tr>
      <td width="32%" bgcolor="#42637B"> <div align="right"><font color="#ADCEE7">USUARIO:</font></div></td>
      <td width="68%"> <? ECHO "$sess_nombre"; ?> </td>
    </tr>
    <tr>
      <td width="32%" bgcolor="#42637B"> <div align="right"><font color="#B5D6EF">DEPARTAMENTO:</font></div>
        <div align="right"></div></td>
      <td width="68%"> <? echo "$sess_departamento"; ?> </td>
    </tr>
  </table>
</div>
<form action="<? echo $PHP_SELF ?>" method="post" enctype="multipart/form-data" >
 
  <table border="1" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td colspan="4"><div align="right"></div>
        <div align="left"> </div></td>
    </tr>
    <tr>
      <td width="150" height="10"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Titular:</font></div></td>
      <td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif">
        <input name="titular" type="text" id="titular" size="75" maxlength="100">    
      </font>
      <td>    
    </tr>
    <tr>
      <td width="150" height="10"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Dirigido a: </font></div></td>
      <td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif">
        <input name="dirigido" type="text" id="dirigido" size="75" maxlength="100">    
      </font>
      <td>    
    </tr>
    <tr>
      <td width="150" height="10"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Perioricidad:</font></div></td>
      <td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif">
        <select name="perioricidad">
          <?             while ($row = mysql_fetch_array($perioricidad)) { ?>
          <option>
          <?             echo ($row["perioricidad"]); ?>
          </option>
          <? } ?>
        </select>
      </font>
      <td width="0"></tr>
    <tr>
      <td width="150" height="3"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Tipo:</font></div></td>
      <td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif">
        <select name="tipo">
          <?             while ($row = mysql_fetch_array($tipo)) { ?>
          <option>
          <?             echo ($row["tipo"]); ?>
          </option>
          <? } ?>
        </select>
        </font></td>
      <td width="0"></tr>
    <tr>
      <td width="150" height="3"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Nombre de archivo: </font></div></td>
      <td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif">
        <input name="nombre" type="text" id="nombre" size="75" maxlength="255">
      </font></td>
      <td>    
    </tr>
    <tr>
      <td width="150" height="31"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Descripci&oacute;n:</font></div></td>
      <td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif">
        <textarea name="descripcion" cols="57" id="descripcion"></textarea>
      </font></td>
      <td width="0"></tr>
    <tr>
      <td width="150" height="20"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Origen</font></div></td>
      <td width="524"><font size="3" face="Arial, Helvetica, sans-serif">
        <input name="origen" type="file" id="origen" size="75" maxlength="255">
      </font></td>
      <td width="115"><font size="3" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
      <td width="0"></tr>
    <tr>
      <td width="150" height="22"><div align="right"><font face="Arial, Helvetica, sans-serif"><font size="3"><font face="Arial, Helvetica, sans-serif"><font size="3"></font></font></font></font></div></td>
      <td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
      <td width="0" rowspan="2">      
    </tr>
    <tr>
      <td height="26" colspan="3"> <div align="center">
          <font size="3" face="Arial, Helvetica, sans-serif">
          <input name="submit" type="submit" value="BUBIR ARCHIVO">
        </font></div></td>
    </tr>
  </table>
</form>
<?php

if (@$submit) {

      //-------------------------------------------------------------------------------------
      //Calcula el valor de la Fecha
      $today = getdate (time());
      $day = $today[ "mday"];
      $month = $today["mon"];
      $year = $today["year"];
      $hour = $today["hours"];
      $minutes = $today["minutes"];
      $seconds = $today["seconds"];
      $fecha = "$year-$month-$day";
      //-------------------------------------------------------------------------------------
      //abre una sesion en la base de datos
      $db = mysql_connect($DBhost,$DBuser,$DBpass) or die("No fué posible conectarse con la Base de Datos.");
      //-------------------------------------------------------------------------------------
      //-------------------------------------------------------------------------------------
      //inserta los valores en la base de datos
      @mysql_select_db("$DBName",$db) or die("Unable to select database $DBName");
      $sql1 = "INSERT INTO $table (usuario,departamento,titular,dirigido,perioricidad,tipo,nombre,descripcion,rutaorigen,fecha) VALUES ('$usuario','$departamento','$titular','$dirigido','$perioricidad','$tipo','$nombre','$descripcion','$origen','$fecha')";
      $result1 = mysql_query($sql1);
      
      //-------------------------------------------------------------------------------------
      //Este Código se ejecuta si se realizaron modificaciones a la DB
      echo('<div align="center"><h3>El Archivo Subió Exitosamente.</h3></div>');


Thank you guys.Start Free Trial
[+][-]08.20.2008 at 03:45PM PDT, ID: 22274627

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP and Databases, PHP Scripting Language, MySQL Server
Tags: php & sql, windows explorer 7.0
Sign Up Now!
Solution Provided By: RQuadling
Participating Experts: 1
Solution Grade: C
 
 
[+][-]08.21.2008 at 09:01AM PDT, ID: 22280976

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.21.2008 at 12:46PM PDT, ID: 22283620

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 05:12AM PDT, ID: 22288908

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 08:18AM PDT, ID: 22290941

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628