creo que en el archivo init.php en la carpeta includes. En la linea 128. No estoy seguro si esa coneccion se usa global, de todas maneras.
Alguien sabe cual es el archivo en cuestion q se encarga de conectar a la db en vbulletin? o no existe ?no creo q se les haya escapado ese detalle...
creo que en el archivo init.php en la carpeta includes. En la linea 128. No estoy seguro si esa coneccion se usa global, de todas maneras.
mejor conectarse con un script manualmente no?![]()
Para que quieres conectarte a la base de datos?
estoy haciendo un hack como el de esta pagina... el top 5 de usuarios activosy nesecito tomar los datos y ordenarlos por post, y ya q estamos podrias ayudarme? me esta dando un error
agrego un modulo al vbadvanced, en vez de usar plantillas, meto todo en un archivo dentro de la carpeta modules llamado "top5.php" (ya q tiene scripts sql), este es el codigo:
(Censure datos criticosCódigo:<?php // ######################### 5 USUARIOS MAS ACTIVOS ######################### $bd_servidor = "IP"; $bd_usuario = "USUARIO"; $bd_clave = "CLAVE"; $bd_nombre = "BASE"; $link = mysql_connect($bd_servidor,$bd_usuario,$bd_clave); mysql_select_db($bd_nombre,$link); $topposter = $DB_site->query_first('SELECT username, posts, userid FROM ' . TABLE_PREFIX . 'user ORDER BY posts DESC LIMIT 5'); $topposter['posts'] = number_format($topposter['posts']); $sql = "SELECT username, posts, userid FROM ' . TABLE_PREFIX . 'user ORDER BY posts DESC LIMIT 0,5"; $result = mysql_query($sql); ?> <table cellpadding="5" align="center" border="0" cellpadding="0" bordercolor="#4B8DF1" bgcolor="#E3F0FB" width="90%"> <tr> <td width="292" height="16"><FONT SIZE=2><b>Usuario</b></FONT></td> <td width="292" height="16"><FONT SIZE=2><b>Posts</b></FONT></td> </tr> <?php while(list($username, $posts, $userid) = mysql_fetch_array($result)); { echo " <tr> <td width=\"292\" height=\"16\"><FONT SIZE=2><b>$username</b></FONT></td> <td width=\"292\" height=\"16\"><FONT SIZE=2><b>$posts</b></FONT></td> </tr>"; } ?> </table>)
Si lo usas como modulo no necesitas poner la coneccion.. vbadvaced hace la coneccion y el modulo es incluido nadamas.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /www/fenix-forum.com.ar/htdocs/foro/modules/top5.php on line 19
quitando el codigo de conexion me quedaria asi:
Código:<?php // ######################### 5 USUARIOS MAS ACTIVOS ######################### $topposter = $DB_site->query_first('SELECT username, posts, userid FROM ' . TABLE_PREFIX . 'user ORDER BY posts DESC LIMIT 5'); $topposter['posts'] = number_format($topposter['posts']); $sql = "SELECT username, posts, userid FROM ' . TABLE_PREFIX . 'user ORDER BY posts DESC LIMIT 0,5"; $result = mysql_query($sql); ?> <table cellpadding="5" align="center" border="0" cellpadding="0" bordercolor="#4B8DF1" bgcolor="#E3F0FB" width="90%"> <tr> <td width="292" height="16"><FONT SIZE=2><b>Usuario</b></FONT></td> <td width="292" height="16"><FONT SIZE=2><b>Posts</b></FONT></td> </tr> <?php while(list($username, $posts, $userid) = mysql_fetch_array($result)); { echo " <tr> <td width=\"292\" height=\"16\"><FONT SIZE=2><b>$username</b></FONT></td> <td width=\"292\" height=\"16\"><FONT SIZE=2><b>$posts</b></FONT></td> </tr>"; } ?> </table>
Prueba poniendolo asi
$DB_site->mysql_fetch_array($result)
:confused:
Veo que tienes dos consultas iguales... para que dos consultas? no se q tratas de hacer y tampoco se mucho php so :confused:
donde pongo eso? :S
:eek: linea 19, o sea cambialo por eso aunque de todos modos te seguira dando otros errores, eso creo no se.. amm bueno sigue probando y luego vemos.
ahora me da error de sintaxis! :S
Parse error: parse error, unexpected '{' in /www/fenix-forum.com.ar/htdocs/foro/modules/top5.php on line 17
Código:<?php // ######################### 5 USUARIOS MAS ACTIVOS ######################### $sql = "SELECT username, posts, userid FROM ' . TABLE_PREFIX . 'user ORDER BY posts DESC LIMIT 0,5"; $result = mysql_query($sql); ?> <table cellpadding="5" align="center" border="0" cellpadding="0" bordercolor="#4B8DF1" bgcolor="#E3F0FB" width="90%"> <tr> <td width="292" height="16"><FONT SIZE=2><b>Usuario</b></FONT></td> <td width="292" height="16"><FONT SIZE=2><b>Posts</b></FONT></td> </tr> <?php while(list($username, $posts, $userid) = $DB_site->mysql_fetch_array($result) { echo " <tr> <td width=\"292\" height=\"16\"><FONT SIZE=2><b>$username</b></FONT></td> <td width=\"292\" height=\"16\"><FONT SIZE=2><b>$posts</b></FONT></td> </tr>"; } ?> </table>
ahi no has cerrado un parentesis.
iria asiCódigo PHP:while(list($username, $posts, $userid) = $DB_site->mysql_fetch_array($result)
Código PHP:while(list($username, $posts, $userid) = $DB_site->mysql_fetch_array($result))
Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /www/fenix-forum.com.ar/htdocs/foro/modules/top5.php on line 6
Warning: mysql_query(): A link to the server could not be established in /www/fenix-forum.com.ar/htdocs/foro/modules/top5.php on line 6
Fatal error: Call to a member function on a non-object in /www/fenix-forum.com.ar/htdocs/foro/modules/top5.php on line 16
q risagracias por la ayuda xD
EDIT: Inserte un codigo de conexion y resolvi los primeros dos problemas.. ahora solo quedo este:
Fatal error: Call to a member function on a non-object in /www/fenix-forum.com.ar/htdocs/foro/modules/top5.php on line 31
solucione mi problemalo q originaba el error era el ' . TABLE_PREFIX . ', lo quite porq no lo uso, pero creo q la sintaxis es otra para q funcione