Verán tengo este problema que no logro descifrar. Tengo dos clases en diferentes archivos y estas son las funciones:
user_class.php
Código PHP:
public function getUserParam2($user_id)
{
if (isset($_SERVER['dbHost']) && ($_SERVER['dbUsr']) && ($_SERVER['dbPsw']) && ($_SERVER['db'])) {
$root = $_SERVER['DOCUMENT_ROOT'];
}else {
$root = $_SERVER['DOCUMENT_ROOT']."/";
}
include ($root."classes/connect.php");
include ($root."classes/user_type.php");
// Create records array
$records = array();
// Execute query
if($results = $db->query("CALL wm.getUserParam2(".$user_id.");")){
if($results->num_rows){
while($row = $results->fetch_object()){
$records[] = $row;
}
$results->free();
$this->setUser($records);
}
}
foreach($records as $r){
$userTypeID = $r->userTypeID;
echo"
<div class='form-group'>
<div class='form-group' style='display: none;'>
<input class='form-control' id='user_id' value='". $r->userID."' name='user_id'>
</div>
<div class='form-group'>
<label for='username'>User Name</label>
<input type='text' class='form-control' id='username' value='". $r->name."' name='username'>
</div>
<div class='form-group'>
<label for='user'>Alias</label>
<input type='text' class='form-control' id='user' value='". $r->username."' name='user'>
</div>
<div class='form-group'>
<label for='password'>Password</label>
<input type='password' class='form-control' id='password' value='". $r->password."' name='password'>
</div>
<div>";
}//END FOR
}// END FUNCTION
Código PHP:
public function getUserTypeSelectParam($userTypeID)
{
if (isset($_SERVER['dbHost']) && ($_SERVER['dbUsr']) && ($_SERVER['dbPsw']) && ($_SERVER['db'])) {
$root = $_SERVER['DOCUMENT_ROOT'];
}else {
$root = $_SERVER['DOCUMENT_ROOT']."/";
}
include ($root."classes/connect.php");
// Create records array
$records = array();
// Execute query
if($results = $db->query("CALL wm.getUserType();")){
if($results->num_rows){
while($row = $results->fetch_object()){
$records[] = $row;
}
$results->free();
$this->setUserType($records);
}
}
echo "
<label> Type User </label>
<select class='form-control' id='userTypeID' name='userTypeID'>";
if(!count($records)){
echo "<option>No data available for this view</option>";
}else{
foreach($records as $r){
if ($userTypeID == $r->userTypeID) {
echo" <option selected value='".$r->userTypeID."'>".$r->userTypeName."</option>";
}else{
echo" <option value='".$r->userTypeID."'>".$r->userTypeName."</option>";
}
}//END FOR
}// END IF
echo"</select>";
}// End Function.
Código PHP:
userType::getUserTypeSelectParam($userTypeID);
Código:
Y no se porque me sale eso, porque si yo llamo la función getUserTypeSelectParam en cualquier documento externo me funciona correctamente. Entonces no se como invocarla dentro de la función. Fatal error: Call to undefined method user::setUserType() in C:\xampp\htdocs\classes\user_type.php on line 68
De verdad se los agradeceré mucho la ayuda que me brinden.