RE: [Phplib-users] making proper use of f($field)
Brought to you by:
nhruby,
richardarcher
|
From: Layne W. <la...@if...> - 2001-09-06 14:13:23
|
> I'm having a bit of trouble using the f($field) method
> provided by the
> DB_Sql class and have only you to turn to.
>
> Within setup.inc, I'm attempting to load an array with user
> data pulled
> from a database and make that array globally accessible for further
> manipulation. Previous tests prove that $userdata["user_id"] is both
> set and global. Also, I have determined that the
> query($query) method
> is functioning as I would expect.
>
> Several websites suggested calling next_record() before
> attempting f(),
The next_record() is necessary, there must be another problem.
By the way, which database are you using? MySQL? Oracle? Other?
When I am having trouble with my queries I echo them out and paste them into
the mysql client to make sure the database is as I expected. You could also
do something like:
$db->query($db_query);
$db->next_record();
echo "<p>$db_query<br>\n";
foreach($db->Record as $column => $data) {
echo "$column : $data<br>\n";
}
> so I have added it, but without luck. Also, I have attempted
> to access
> the data as $db->Record["FIELDNAME"],
> $db->Record["TABLENAME.FIELDNAME"], and
> $db->f("TABLENAME.FIELDNAME").
The column names will be whatever is specified within your SQL query -
tablename.fieldname would only work if you did something like:
select username as users.username, firstname as users.firstname ... from
users where ...
Layne Weathers
Ifworld Inc
|