MySQL Error

  • ben_sigma
  • Beginner
  • Beginner
  • Avatar de Usuario
  • Registrado: Mar 12, 2008
  • Mensajes: 58
  • Loc: South Australia
  • Status: Offline

Nota Agosto 12th, 2008, 6:55 pm

Hola de nuevo a todos,

Me pasó este error de mi página y no puede averiguar el problema.
¿Ideas?

Código: [ Select ]
Warning: mysql_close(): 12 is not a valid MySQL-Link resource in C:\xampp\htdocs\bluehole\includes\firefox\localevent\localeventscript.php on line 31


Revisé la línea 31 y este es el código en esa línea:
Código: [ Select ]
mysql_close($con);


Una vez más se aprecia Ayuda :D
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Agosto 12th, 2008, 6:55 pm

  • Bogey
  • Bogey
  • Genius
  • Avatar de Usuario
  • Registrado: Jul 14, 2005
  • Mensajes: 8211
  • Loc: USA
  • Status: Offline

Nota Agosto 12th, 2008, 7:29 pm

¿Qué es con dólares?
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • ben_sigma
  • Beginner
  • Beginner
  • Avatar de Usuario
  • Registrado: Mar 12, 2008
  • Mensajes: 58
  • Loc: South Australia
  • Status: Offline

Nota Agosto 12th, 2008, 8:12 pm

de dólares es sólo con el nombre de la conexión a la base de datos.
  • ben_sigma
  • Beginner
  • Beginner
  • Avatar de Usuario
  • Registrado: Mar 12, 2008
  • Mensajes: 58
  • Loc: South Australia
  • Status: Offline

Nota Agosto 12th, 2008, 8:15 pm

Este es el código completo.
Código: [ Select ]
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("blue_users", $con);
$result = mysql_query("SELECT * FROM events");

echo "<table id='eventstable'>";
echo "<tr style='width: 100%;'><th id='etth'>By</th> <th id='etth'>Date</th> <th id='etth' style='width: 120px;'>Title</th></tr>";
while($row = mysql_fetch_array($result))
    {
    $set = mysql_connect("localhost","root","");
    if (!$set)
        {
        die('Could not connect: ' . mysql_error());
        }
    mysql_select_db("blue_users", $set);
    $result2 = mysql_query("SELECT * FROM user_details WHERE id='".$row['postedby']."'");
    while($row2 = mysql_fetch_array($result2))
        {
        echo "<tr><td>".$row2['DisplayName']."</td>";
        }
    mysql_close($set);
    echo "<td>".$row['date']."</td><td>".$row['title']."</td></tr>";
    }
echo "</table>";
mysql_close($con);
?>
  1. <?php
  2. $con = mysql_connect("localhost","root","");
  3. if (!$con)
  4. {
  5. die('Could not connect: ' . mysql_error());
  6. }
  7. mysql_select_db("blue_users", $con);
  8. $result = mysql_query("SELECT * FROM events");
  9. echo "<table id='eventstable'>";
  10. echo "<tr style='width: 100%;'><th id='etth'>By</th> <th id='etth'>Date</th> <th id='etth' style='width: 120px;'>Title</th></tr>";
  11. while($row = mysql_fetch_array($result))
  12.     {
  13.     $set = mysql_connect("localhost","root","");
  14.     if (!$set)
  15.         {
  16.         die('Could not connect: ' . mysql_error());
  17.         }
  18.     mysql_select_db("blue_users", $set);
  19.     $result2 = mysql_query("SELECT * FROM user_details WHERE id='".$row['postedby']."'");
  20.     while($row2 = mysql_fetch_array($result2))
  21.         {
  22.         echo "<tr><td>".$row2['DisplayName']."</td>";
  23.         }
  24.     mysql_close($set);
  25.     echo "<td>".$row['date']."</td><td>".$row['title']."</td></tr>";
  26.     }
  27. echo "</table>";
  28. mysql_close($con);
  29. ?>
  • righteous_trespasser
  • Scuffle
  • Genius
  • Avatar de Usuario
  • Registrado: Mar 12, 2007
  • Mensajes: 6228
  • Loc: South-Africa
  • Status: Offline

Nota Agosto 12th, 2008, 10:49 pm

Yo no sé sobre el error, pero usted podría hacer que la consulta en un solo lugar de dos, me parece...algo así como...
Código: [ Select ]
SELECT * FROM events LEFT JOIN user_details ON events.postedby = user_details.id

de esa manera usted no tiene que abrir la conexión tantas veces, sólo una vez...y entonces el wouldnt de error de estar allí de todos modos Im seguro...Sé que esto no es exactamente la solución que usted quería, pero creo que de esta manera es mejor...
Let's leave all our *plum* where it is and go live in the jungle ...
  • ben_sigma
  • Beginner
  • Beginner
  • Avatar de Usuario
  • Registrado: Mar 12, 2008
  • Mensajes: 58
  • Loc: South Australia
  • Status: Offline

Nota Agosto 13th, 2008, 12:06 am

hey gracias montones i cambió mi script y funciona perfectamente.

Apreciado
  • righteous_trespasser
  • Scuffle
  • Genius
  • Avatar de Usuario
  • Registrado: Mar 12, 2007
  • Mensajes: 6228
  • Loc: South-Africa
  • Status: Offline

Nota Agosto 13th, 2008, 4:41 am

excelente. Im Me alegro de que usted ayudó a couldve...
Let's leave all our *plum* where it is and go live in the jungle ...

Publicar Información

  • Total de mensajes en este tema: 7 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 127 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC