anduvo barbaro, gracias... pero ahora el tema es q lo voy a necesitar igual xD ya que necesito usar las siguientes funciones (definidas en una classe) las voy a necesitar usar dentro de otras classes.... pero me salta error en el mysql_fetch_array... te muestro el script...
el tema es asi, yo en una clase de un archivo: functions.php tengo lo siguiente:
Código PHP:
<?php
class MySQLFunction{
private $_query;
public $_error;
private $_result;
public function ConnectMySQL($Table, $FieldsOrder, $Order, $Limit){
if($Table == ''){
$this->_error = 'Table could not be found.';
return $this->_error;
}
else{
if($FieldsOrder == '' && $Limit != ''){
$this->_query = mysql_query("SELECT * FROM $Table LIMIT $Limit") or die(_MYSQL_ERROR_);
return $this->_query;
}
else if($FieldsOrder != '' && $Limit == ''){
switch($Order){
case cres : $DefineOrder = 'ASC'; break;
case decr : $DefineOrder = 'DESC'; break;
}
$this->_query = mysql_query("SELECT * FROM $Table ORDER BY $FieldsOrder $DefineOrder") or die(_MYSQL_ERROR_);
return $this->_query;
}
else if($FieldsOrder != '' && $Limit != ''){
switch($Order){
case cres : $DefineOrder = 'ASC'; break;
case decr : $DefineOrder = 'DESC'; break;
}
$this->_query = mysql_query("SELECT * FROM $Table ORDER BY $FieldsOrder $DefineOrder LIMIT $Limit") or die(_MYSQL_ERROR_);
return $this->_query;
}
else{
$this->_query = mysql_query("SELECT * FROM $Table") or die(_MYSQL_ERROR_);
return $this->_query;
}
}
}
}
class GetUserInfo{
private $_query;
private $_fetch;
private $_user;
private $_id;
public function UserID($User){
$this->_query = MySQLFunctions::ConnectMySQL($USERS_TABLE, "", "", "");
while($this->_fetch = mysql_fetch_array($this->_query)){
if($this->_fetch['User'] == $User){
$this->_id = $this->_fetch['ID'];
}
}
return $this->_id;
}
public function User($ID){
$this->_query = MySQLFunctions::ConnectMySQL($USERS_TABLE, "", "", "");
while($this->_fetch = mysql_fetch_array($this->_query)){
if($this->_fetch['ID'] == $ID){
$this->_user = $this->_fetch['User'];
}
}
return $this->_user;
}
}
?>
Lo que necesito es usar las 2 ultimas funciones: una para obtener ID segund User, y la otra para obtener User, segun ID... Fuera de classes, solian andar... pero ahora lo puse asi, y lo necesito usar en otra clase, pero me da error en el mysql_fetch_array()
Alguien me dice que es lo que tengo mal :S? como veran, soy nuevo en php y mucho no se...
hasta luego.