PHP pg_fetch_assoc() complaining about parameters
Lonni J Friedman
netllama
Tue Jul 24 16:53:40 PDT 2007
Hopefully one of you PHP wizards will find this easy. I've got this
PHP script that I'm writing. Its 100% functional, but since I'm
basically duplicating the same code across 3 variants of the script, I
figured I'd put the duplicated code into a single file, call it as an
include, and come out ahead. Sadly, i've had nothing but problems
with it since trying to move stuff into an include.
In the included file, I've (currently) got a single function (called
grabData), with a while loop that looks like this:
grabData ($r_fdtd) {
while($row=pg_fetch_assoc($r_fdtd)){
$data_fdtd[]=$row['norm'];
$xdata_fdtd[]=$row['date_created'];
}}
In the main PHP script, I've got the following:
$q_fdtd=("select * from fdtd where gpu='80' AND os='2.6.9-55.ELsmp'
ORDER BY date_created");
$r_fdtd=pg_exec($db, $q_fdtd);
grabData ("$r_fdtd");
The big issue right now is the following error appears in the apache
error log every time the php script runs:
pg_fetch_assoc() expects parameter 1 to be resource, string given
I can't figure out why the variable that I'm passing to the included
function is getting treated as a string when it should be a resource.
Anyone see what i'm doing wrong?
thanks in advance.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman netllama at gmail.com
LlamaLand http://netllama.linux-sxs.org
More information about the Linux-users
mailing list