Foros del Web » Programando para Internet » PHP »

[SOLUCIONADO] mysql_fetch_object(): supplied argument is not a valid MySQL result

Estas en el tema de mysql_fetch_object(): supplied argument is not a valid MySQL result en el foro de PHP en Foros del Web. Por favor, ayudadme a encontrar el error: function football() { require("dbinfo.php"); $this->host = HOST; $this->pass = PASS; $this->user = USER; $this->database = DB; $this->prefix = ...
  #1 (permalink)  
Antiguo 16/11/2013, 17:03
 
Fecha de Ingreso: noviembre-2009
Mensajes: 9
Antigüedad: 14 años, 5 meses
Puntos: 0
mysql_fetch_object(): supplied argument is not a valid MySQL result

Por favor, ayudadme a encontrar el error:

function football()
{
require("dbinfo.php");
$this->host = HOST;
$this->pass = PASS;
$this->user = USER;
$this->database = DB;
$this->prefix = PREFIX;
$this->db = $this->dbConnect();
// set variables from database
$sql = "select * from ".$this->prefix."variables where PoolID = 1";
$rs = $this->dbQuery($sql);
while($row = mysql_fetch_object($rs))
{
$this->admin_username = $row->admin_username;
$this->admin_email = $row->admin_email;
$this->domain = $row->domain;
$this->offset = $row->offset;
$this->display_offset = $row->display_offset;
$this->game_display_offset = $row->game_display_offset;
$this->timezone .= $row->timezone;
$this->timezone_display = $row->timezone_display;
$this->sitetitle = $row->sitetitle;
$this->copyright = $row->copyright;
$this->copyrightweb = $row->copyrightweb;
$this->showPicks = $row->showpicks;
$this->password_min_len = $row->password_min_len;
$this->bet_amount = $row->bet_amount;
$this->display_graphics = $row->display_graphics;
$this->logo_width = $row->logo_width;
$this->rssurl = $row->rssurl;
$this->showSpread = $row->showSpread;
$this->usespread = $row->spread;
$this->UseSMTP = $row->UseSMTP;
$this->SMTPHost = $row->SMTPHost;
$this->SMTPUser = $row->SMTPUser;
$this->SMTPPassWord = $row->SMTPPassWord;
}
}
  #2 (permalink)  
Antiguo 16/11/2013, 17:24
Avatar de xSkArx  
Fecha de Ingreso: marzo-2008
Ubicación: Chile
Mensajes: 945
Antigüedad: 16 años, 1 mes
Puntos: 96
Respuesta: mysql_fetch_object(): supplied argument is not a valid MySQL result

Tu problema puede eatar aqui
Código PHP:
Ver original
  1. $rs = $this->dbQuery($sql);
Si nos puedes moatrar el codigo del metodo dbQuery() seria mejor
__________________
Busca, lee y practica todo lo que puedas.
Usa siempre el buscador antes de postear.
Si posteas código, utiliza el HIGHLIGHT correcto.
  #3 (permalink)  
Antiguo 16/11/2013, 17:37
 
Fecha de Ingreso: noviembre-2009
Mensajes: 9
Antigüedad: 14 años, 5 meses
Puntos: 0
Respuesta: mysql_fetch_object(): supplied argument is not a valid MySQL result

Esta aquí:

function dbConnect()
{
$db = @mysql_connect($this->host, $this->user, $this->pass);
return $db;
}

function dbQuery($sql)
{

@mysql_select_db($this->database,$this->db); // or die("<p><b>MySQL Error</b>: ".mysql_errno()." (".mysql_error().")<br>\n$sql</p>");

$rs = @mysql_query($sql,$this->db); // or die("<p><b>MySQL Error</b>: ".mysql_errno()." (".mysql_error().")<br>\n$sql</p>");
return $rs;
}
function dbCheck()
{
$db_selected = mysql_select_db($this->database,$this->db);
if (!$db_selected) {
$this->ErrorMessage("Database ".$this->database." Doesn't exists Please create database to continue");
$error = "error";
return $error;
}
}
  #4 (permalink)  
Antiguo 16/11/2013, 18:20
Avatar de xSkArx  
Fecha de Ingreso: marzo-2008
Ubicación: Chile
Mensajes: 945
Antigüedad: 16 años, 1 mes
Puntos: 96
Respuesta: mysql_fetch_object(): supplied argument is not a valid MySQL result

Código PHP:
Ver original
  1. $rs = mysql_query($sql,$this->db) or die("<p><b>MySQL Error</b>: ".mysql_errno()." (".mysql_error().")<br>\n$sql</p>");
  2. return $rs; }ti
__________________
Busca, lee y practica todo lo que puedas.
Usa siempre el buscador antes de postear.
Si posteas código, utiliza el HIGHLIGHT correcto.
  #5 (permalink)  
Antiguo 17/11/2013, 11:32
 
Fecha de Ingreso: noviembre-2009
Mensajes: 9
Antigüedad: 14 años, 5 meses
Puntos: 0
Respuesta: mysql_fetch_object(): supplied argument is not a valid MySQL result

¡Muchas gracias, solucionado!

Etiquetas: mysql, result, select, sql, variable
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 19:24.