guys, i need your help once again.
My problem is the method of one of my classes seems to return only one
record. I have attached all the files which contains the scripts that i
used. Please help me analyze and look for the solution to my problem.
The [adminIndex.php] shall display a table containing set of records from
a query by calling the viewHealthINst() method from [users.php].
===
include_once("class/users.php");
$newUser = new user;
$row = $newUser->viewHealthInst();
===
The viewHealthInst() method executes a query that will return some fields
of all the records in the table. This method will call the query() and
fetch_array() methods of the mysql class[connectDB.php]. The mysql class
has this fetch_array() method that returns the result of the query.
===
class user extends mysql
{
//... i didnot display some functions
function viewHealthInst()
{
$result = $this->query("SELECT healthInstID, healthInsName,
healthInsType FROM tblinstitution ORDER BY healthInsName");
$row = $this->fetch_array($result);
return $row;
}
function fetch_array($result) {
$this->data_array = mysql_fetch_array($result, MYSQL_ASSOC);
return $this->data_array;
}
}
===
And then I now output it with a while loop. The while loops excutes
endlessly that's why i have to stop it. Only one record is in the $row.
===
while($row)
{
echo $row['healthInstID'];
echo $row['healthInsName'];
echo $row['healthInsType'];
}
===
When i tried to output the $row value, i got this. which means that i only
got one record.
===
Array ( [healthInstID] => 2 [healthInsName] => East Avenue Medical Center
[healthInsType] => City Health Center )
===
The tblinstitution table have this records
===
healthInstID healthInsType healthInsName
1 others Medical Informatics Unit
2 City Health Center East Avenue Medical Center
===
query() and fetch_array() methods work well because I also use it in some
of my scripts. But I'm not sure if have a correct syntax for my classes. I
am very new in my object-oriented programming and Im still studying the
behaviours of a class that includes its methods and objects. Please help
me....
[Non-text portions of this message have been removed]
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/