Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General » Mysql »

Error que me esta dejando loco

Estas en el tema de Error que me esta dejando loco en el foro de Mysql en Foros del Web. Veréis estoy modificando una web ya echa y la subí a mi host, el primer problema que tuve fueron detectar todas las conexión que tenia ...
  #1 (permalink)  
Antiguo 26/05/2010, 19:25
 
Fecha de Ingreso: mayo-2010
Mensajes: 2
Antigüedad: 14 años
Puntos: 0
Error que me esta dejando loco

Veréis estoy modificando una web ya echa y la subí a mi host, el primer problema que tuve fueron detectar todas las conexión que tenia la web con su base de datos anterior, bien vaya al problema yo tengo un menú como el que pondré en la imagen siguiente y al intentar acceder a las tablas de la base de datos me salen los siguientes errores que también se verán en la imagen.
http://img594.imageshack.us/img594/1858/errord.png

CODIGO DEL INDEX

Código PHP:
<? session_start(); ?>
<HTML>
 <HEAD>
  <TITLE> DPLUS3 </TITLE>
  <? include "css.php"?>            <!-- CSS -->
  <? include "../js.php"?>            <!-- JS -->    
      <SCRIPT LANGUAGE="JavaScript">
    var cal = new CalendarPopup();
    </SCRIPT>
 </HEAD>    

<? $path "../../llibreria";                                                            // INCLUDES
   
include $path."/grafics/taules/taula1/_taula1.php";
   include 
$path."/yahoo_api/_taula_js.php";
   include 
$path."/yahoo_api/_pestanyes.php";
   include 
$path."/yahoo_api/_llista_drag&drop.php";
   include 
$path."/yahoo_api/_msg.php";
   include 
$path."/bbdd/_f.php";
   include 
$path."/bbdd/_formulari.php";
   include 
$path."/bbdd/_combo_sql.php";   
   include 
$path."/bbdd/_taula_sql.php";
   include 
$path."/utils/utils.php";
   include 
$path."/utils/dates.php";
   include 
$path."/utils/crypt.php";
   include 
$path."/utils/_mail_html.php";
   
//http://tinymce.moxiecode.com/index.php

   //CONNEXIONS BBDD    
   
$conn_my mysql_connect ("xxxxxxx""xxxxx","xxxxx");                //connexió mysql                    
   
mysql_select_db("xxxxx"$conn_my );                                
   
       
  
   
//VARIABLES DE SESSIÓ
   
$_SESSION["pwd"] = "xxx";
   
$_SESSION["conn_my"] = $conn_my;   
   


   
//VALIDACIÓ ACCÈS
   
if ($_POST["PWD"] == "1")
        
$_SESSION["in"] = "si";

    
//OPCIÓ DEL SWITCH. RECOLLIDA DE PARAMETRES GET ENCRIPTATS
    
if ($_POST["_op"] != ""    ) {
        
$r[0] = $_POST["_op"];    
        
$r[1] = $_POST["offset"];
        
$r[2] = $_POST["limit"];
        
$r[3] = $_POST["paraula"];
        
$r[4] = $_POST["_id"];
    } else {
        
$r GET2Arraydecryptsubstr($_SERVER["REQUEST_URI"],strpos($_SERVER["REQUEST_URI"],"?")+1,100), $_SESSION["pwd"]) );        //posa a l'array r els paràmetres GET (desencriptats)
    
}   


?>

<BODY TOPMARGIN="0" LEFTMARGIN="0" class="yui-skin-sam">
                
<?         
    
if ( strpos($r[1],".") >=0)
?>         
<SCRIPT>//location.href = 'xxxxxxx'</SCRIPT> 
<?
    
if ($_SESSION["in"] == "si") { 
?>

<TABLE WIDTH="100%" HEIGHT="100%" BORDER="0">
<TR>
    <TD WIDTH="270" VALIGN="TOP"><? taula1("blau",270,"100%","","./inc/_menu_esq.php","../"); ?></TD>
    <TD VALIGN="TOP" ALIGN="CENTER" HEIGHT="100%"><BR><BR><BR>
        <?  
            
            $z
="op=".$r[0]."&offset=0&limit=25&paraula=&order=order by ";
            
$consulta mysql_query ("SELECT COUNT(*) FROM __clients WHERE email LIKE '".$_POST["user"]."' AND pwd LIKE '".$_POST["pwd"]."'") or die (mysql_eror());
            switch ( 
$r[0] ) { 
                        
                       case 
taula_sql(1,                                                            
                                      
"TABLE1",                                                        
                                      
"taula_sql",
                                      
"#FFFFFF,#EDF5FF",
                                      
"110,70,150,150,120,130",
                                       
"Nº DE TRABAJO,DATA,RESPONSABLE,PACIENTE,FICHERO 3D,SITUACIÓN",
                                      
"",              
                                      
"my"
                                      
"SELECT fit.id,fit.n_feina,data_cat,responsable,pacient,3d,sit.situacio FROM __fitxes fit, __clients cli, __situacions sit WHERE fit.id_client=cli.id AND fit.situacio=sit.id AND cli.id = ".$_SESSION["id_client"]." AND fit.situacio = 5 ".$r[4]." LIMIT ".$r[1].",".$r[2],
                                      
$r[3],
                                      
$r[4],
                                      
25,
                                      
"",
                                      
"",        //delete
                                      
$z."n_feina,".$z."fit.data,".$z."responsable,".$z."pacient,".$z."fit.3d,".$z."sit.situacio",        
                                      
"op=3&id=,,,,op=2&id=",
                                      
"0,,,,5");
                             break;

                        case 

                                  
?> <SCRIPT>location.href = 'xxxxx'</SCRIPT> <?
                                 
break;

                        case 
pestanyes(700,550,$pestanya,
                                          
"HACER OBSERVACIONES,RESPUESTA DE DPLUS3",
                                          
"./inc/3_observacions.php,./inc/3_resposta.php");
                                 break;

                        case 
taula_sql(4,                                                            
                                      
"TABLE1",                                                        
                                      
"taula_sql",
                                      
"#FFFFFF,#EDF5FF",
                                      
"110,70,150,150,120,130",
                                       
"Nº DE TRABAJO,DATA,RESPONSABLE,PACIENTE,FICHERO 3D,SITUACIÓN",
                                      
"",              
                                      
"my"
                                      
"SELECT fit.id,fit.n_feina,data_cat,responsable,pacient,3d,sit.situacio FROM __fitxes fit, __clients cli, __situacions sit WHERE fit.id_client=cli.id AND fit.situacio=sit.id AND cli.id = ".$_SESSION["id_client"]." AND fit.situacio NOT LIKE 5 AND fit.situacio NOT LIKE 12 ".$r[4]." LIMIT ".$r[1].",".$r[2],
                                      
$r[3],
                                      
$r[4],
                                      
25,
                                      
"",
                                      
"",        //delete
                                      
$z."n_feina,".$z."fit.data,".$z."responsable,".$z."pacient,".$z."fit.3d,".$z."sit.situacio",        
                                      
",,,,op=2&id=",
                                      
"0,,,,5");
                                    
                             break;

                         case 
: include "./inc/27_pwd.php";
                                break; 

                         case 
taula_sql(7,                                                            
                                      
"TABLE1",                                                        
                                      
"taula_sql",
                                      
"#FFFFFF,#EDF5FF",
                                      
"110,70,150,150,120,130",
                                       
"Nº DE TRABAJO,DATA,RESPONSABLE,PACIENTE,FICHERO 3D,SITUACIÓN",
                                      
"",              
                                      
"my"
                                      
"SELECT fit.id,fit.n_feina,data_cat,responsable,pacient,3d,sit.situacio FROM __fitxes fit, __clients cli, __situacions sit WHERE fit.id_client=cli.id AND fit.situacio=sit.id AND cli.id = ".$_SESSION["id_client"]." AND fit.situacio = 12 ".$r[4]." LIMIT ".$r[1].",".$r[2],
                                      
$r[3],
                                      
$r[4],
                                      
25,
                                      
"",
                                      
"",        //delete
                                      
$z."n_feina,".$z."fit.data,".$z."responsable,".$z."pacient,".$z."fit.3d,".$z."sit.situacio",        
                                      
",,,,op=2&id=",
                                      
"0,,,,5");
                             break;
                        
                        case 
: include "inc/3_alta_fitxa.php";
;
                             break;




                        default : echo 
"<IMG SRC='../imgs/Logo.gif'>";
                                 break;
                        
            }  
            
            if (
$_SESSION["error"] == "" )
            {
               if (
$_POST["_url_retorn"] != "")
                   echo 
'<SCRIPT>location.href = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"</SCRIPT>';
           }
           else {
                 echo 
"<SCRIPT>alert('".$_SESSION["error"]."')</SCRIPT>";
                 
$_SESSION["error"] = "";
           }
         
?>    
    </TD>
</TR>
</TABLE>
<? }
     else
         echo 
"<SCRIPT>location.href='xxxxxxxxxxxxxx'</SCRIPT>";
?>
</BODY>
</HTML>

Última edición por bras111; 26/05/2010 a las 19:33
  #2 (permalink)  
Antiguo 26/05/2010, 19:28
 
Fecha de Ingreso: mayo-2010
Mensajes: 2
Antigüedad: 14 años
Puntos: 0
Respuesta: Error que me esta dejando loco

CODIGO TAULA_SQL
Código PHP:
<?            
/*    PARÀMETRES GENERALS
        1. "operacio"     => opció del switch principal    

    PARÀMETRES GRÀFICS
        2. "class"          => estil de la taula 
        3. "estil_href"   => estil dels links
        4. "colors_alt"      => colors de les files alterantius
        5. "ws"              => (array) amplada de cada columna
        6. "titols"          => (array) títol de cada columna
        7. "imatges"      => (array) imatges que actuen com a link. S'ha d'indicar per ordre ( títol columna, amplada columna, imatge, link i nº de camp de la bbdd que li passen al link )        

    PARÀMETRES SQL
        8. "tipus"          => si la bbdd és MySQL o PostgreeSQL
        9. "sql"          => consulta sql
       10. "paraula"      => paraula que serveix de filtre. El camp que actual de filtre el determina el paràmetre "$sql"
       11. "ordre"        => ordre de la taula ( forçat per GET )        
       12. "n_resultats"  => nº de files de la taula       
       13. "taula"          => indica de quina taula s'esborrarà el registre amb id = al paràmetre "$delete"        
       14. "delete"          => id de "$taula" que s'ha de borrar              

    PARÀMETRES DELS LINKS
          15. "titols_ordre" => link dels títols per a ordenar per columnes    
       16. "url_link"      => link a una altra pàgina a la que passem un paràmetre 
       17. "camp_link"      => (array) nº del camp de la consulta sql que es passa com a paràmetre a un link               */

function taula_sql $operacio,      
                     
$class,          
                     
$estil_href,      
                     
$colors_alt,      
                     
$ws,  
                     
$titols,      
                     
$imatges,
                     
$tipus,
                     
$sql,                     
                     
$paraula,        
                     
$ordre,        
                     
$n_resultats,        
                     
$taula,        
                     
$delete,        
                     
$titols_ordre,    
                     
$url_link,
                     
$camp_link     )        

    
//1 - PARÀMETRES A ARRAYS                                    //converteixo els paràmetres en arrays, per a poder treballar millor a l'hora de tractar
    
$ws_ split","$ws );                                    //columna per columna
    
$titols_ split","$titols );
    
$url_link_split","$url_link );
    
$camp_link_ split","$camp_link );
    
$imatges_ split","$imatges );
    
$ordres_ split","$titols_ordre );
    
$color_ split","$colors_alt );

//echo $sql;
    //Abans de crear la taula, si rebo el paràmetre DEL, elimino el registre corresponent 
    
if ($delete != "") {
        if (
$tipus == "my") {
            
_p("my","DELETE FROM ".$taula." WHERE id = ".$delete$_SESSION["conn_my"]); 
            
//echo "DELETE FROM ".$taula." WHERE id = ".$delete;
        
} else {
            
_p("pg","DELETE FROM ".$taula." WHERE id = ".$delete$_SESSION["conn_pg"]);
        }
    } 
?>                     

<TABLE CLASS="<? echo $class ?>" >

 <? // TITOLS TAULA 
    
for ($i=0$i<count($ws_); $i++) { ?>    
          <TH CLASS="TH1" WIDTH="<? echo $ws_[$i?>" ALIGN="CENTER"><A HREF="index.php?<? echo encrypt$ordres_[$i], $_SESSION["pwd"]) ?>" CLASS="<? echo $estil_href ?>"><? echo $titols_[$i]?></A></TH>
         <? 

    if (
$imatges != "") {
        
$i=0$j=0;
        while ( 
$j < (count($imatges_)/5) ) {   ?>
             <TH CLASS="TH1" WIDTH="<? echo $imatges_[$i+1?>"><? echo $imatges_[$i?></TH>
        <? $i=$i+5;
           
$j++;    
        } 
    } 

    if (
$tipus == "my") {

            
$rs mysql_query$sql $_SESSION["conn_my"]);
//echo $sql;
            // DADES TAULA  
            
while ($row mysql_fetch_row($rs)) { ?>                       
               
                          <TR HEIGHT="25" BGCOLOR="<? echo $color_[$k &#37; 2 ] ?>">
                    <? for ($i=0$i<count($ws_); $i++) {
                            if ( 
$url_link_[$i] == "" )  { ?>
                                <TD WIDTH="<? echo $ws_[$i?>" CLASS="TD1"><? echo $row[$i+1?></TD>
                            <? } else { 
                                    if (
substr($url_link_[$i],0,4) == "http") {?>            <!-- links sense encriptar -->
                                        <TD WIDTH="<? echo $ws_[$i?>" CLASS="TD1"><A HREF="<? echo $url_link_[$i].$row[$camp_link_[$i]] ?>" CLASS="<? echo $estil_href ?>"><? echo $row[$i+1?></A></TD>
                                <?  } else { ?>
                                        <TD WIDTH="<? echo $ws_[$i?>" CLASS="TD1"><A HREF="index.php?<? echo encrypt$url_link_[$i].$row[$camp_link_[$i]], $_SESSION["pwd"]) ?>" CLASS="<? echo $estil_href ?>"><? echo $row[$i+1?></A></TD>
                                <? }
                            }
                       } 
                       

                       if (
$imatges != "") {
                           
$i=0$j=0;
                           while ( 
$j < (count($imatges_)/5) ) {   
                                   if ( 
substr($imatges_[$i+3],0,1) != "\\" ) { ?>                                  
                                        <TD CLASS="TD1" ALIGN="CENTER"><A HREF="index.php?<? echo encrypt($imatges_[$i+3].$row[$imatges_[$i+4]], $_SESSION["pwd"]) ?>"><IMG SRC="<? echo $imatges_[$i+2?>" BORDER="0"></A>
                                   <? }                     
                           <? 
$i=$i+5;
                              
$j++; 
                           } 
                       }
?>
                          </TR>

        <?        $k++; 
            } 
    } else {  
//echo $sql;
            
$rs pg_exec$_SESSION["conn_pg"], $sql );

            
// DADES TAULA  
            
while ($row pg_fetch_row($rs)) {  ?>                       
               
                          <TR HEIGHT="25" BGCOLOR="<? echo $color_[$k ?>">
                    <? for ($i=0$i<count($ws_); $i++) {
                            if ( 
$url_link_[$i] == "" )  { ?>
                                <TD WIDTH="<? echo $ws_[$i?>" CLASS="TD1"><? echo $row[$i+1?></TD>
                            <? } else { ?>
                                <TD WIDTH="<? echo $ws_[$i?>" CLASS="TD1"><A HREF="index.php?<? echo encrypt$url_link_[$i].$row[$camp_link_[$i]], $_SESSION["pwd"]) ?>" CLASS="<? echo $estil_href ?>"><? echo $row[$i+1?></A></TD>    
                    <?        }
                       } 
                       

                       if (
$imatges != "") {
                           
$i=0$j=0;
                           while ( 
$j < (count($imatges_)/5) ) {   ?>
                                <TD CLASS="TD1" ALIGN="CENTER"><A HREF="<? echo $imatges_[$i+3].$row[$imatges_[$i+4]] ?>"><IMG SRC="<? echo $imatges_[$i+2?>" BORDER="0"></A>
                           <? $i=$i+5;
                              
$j++; 
                           } 
                       }
?>
                          </TR>

        <?        $k++; 
            } 
    }
?>

</TABLE>
<BR><BR>
<? 

$r 
GET2Arraydecryptsubstr($_SERVER["REQUEST_URI"],strpos($_SERVER["REQUEST_URI"],"?")+1,100), $_SESSION["pwd"]) );        //posa a l'array r els paràmetres GET (desencriptats)
$ordre $r[4];

//NÚMERO DE PÀGINES

if ($n_resultats 30) {

if (
$n_resultats 0) {
    
$post_FROM strpos($sql,"FROM")+5;
    
if (
$tipus == "my") {    
    
$pre_LIMIT strpos($sql,"LIMIT");
    
$sql_ "SELECT COUNT(*) FROM ".substr($sql$post_FROM$pre_LIMIT $post_FROM);        
    
$rs mysql_query$sql_$_SESSION["conn_my"]);

    
$i=0;
    
$pag=1;    

    echo 
"<A HREF='index.php?".encrypt("op=".$operacio."&offset=0&limit=".$n_resultats."&paraula=".$paraula."&ordre=".$ordre,$_SESSION["pwd"])."' CLASS='".$estil_href."'>|<</A>&nbsp;&nbsp;";

    while (
$i <= mysql_result($rs,0,0)) {
         
$estil_a $estil_href;
         if ( (
$pag-1) == ($r[1] / $n_resultats) )
               
$estil_a "pagina_actual";            //canviar l'estil per saber pàgina actua

         
echo "<A HREF='index.php?".encrypt("op=".$operacio."&offset=".(($pag-1)*$n_resultats)."&limit=".$n_resultats."&paraula=".$paraula."&ordre=".$ordre,$_SESSION["pwd"])."' CLASS='".$estil_a."'>".$pag."</A>&nbsp;&nbsp;";
           
$i=$i $n_resultats;
         
$pag++;
    }

    echo 
"<A HREF='index.php?".encrypt("op=".$operacio."&offset=".(($pag-2)*$n_resultats)."&limit=".$n_resultats."&paraula=".$paraula."&ordre=".$ordre,$_SESSION["pwd"])."' CLASS='".$estil_href."'>>|</A>&nbsp;&nbsp;";
    
} else {
    
$pre_OFFSET strpos($sql,"OFFSET");
    
$sql_ "SELECT * FROM ".substr($sql$post_FROM$pre_OFFSET $post_FROM);
    
$rs pg_exec($_SESSION["conn_pg"], $sql_);

    
$i=0;
    
$pag=1;    

    echo 
"<A HREF='index.php?".encrypt("op=".$operacio."&offset=0&limit=".$n_resultats."&paraula=".$paraula."&ordre=".$ordre,$_SESSION["pwd"])."' CLASS='".$estil_href."'>|<</A>&nbsp;&nbsp;";

    while (
$i <= pg_num_rows($rs) ) {
         
$estil_a $estil_href;
         if ( (
$pag-1) == ($r[1] / $n_resultats) )
               
$estil_a "pagina_actual";            //canviar l'estil per saber pàgina actual

         
echo "<A HREF='index.php?".encrypt("op=".$operacio."&offset=".(($pag-1)*$n_resultats)."&limit=".$n_resultats."&paraula=".$paraula."&ordre=".$ordre,$_SESSION["pwd"])."' CLASS='".$estil_a."'>".$pag."</A>&nbsp;&nbsp;";
           
$i=$i $n_resultats;
         
$pag++;
    }

    echo 
"<A HREF='index.php?".encrypt("op=".$operacio."&offset=".(($pag-2)*$n_resultats)."&limit=".$n_resultats."&paraula=".$paraula."&ordre=".$ordre,$_SESSION["pwd"])."' CLASS='".$estil_href."'>>|</A>&nbsp;&nbsp;";
}

}

}



?>

Etiquetas: loco
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:56.