[plug] mysql/associativearrays/objects/something wierdness.
Shayne O'Neill
shayne at guild.murdoch.edu.au
Mon Sep 27 12:35:15 WST 2004
I'm having a rather strange problem.
This class basically iiterates thru a bunch of records and inserts them
into a template.
The data is of this format;-
Field Type Null Default
id int(11) No
stamp timestamp(14) Yes NULL
jobtitle text No
location text No
paytype text No
shortdescription text No
advertisement text No
password text No
expirydate datetime No 0000-00-00 00:00:00
contactdetails text No
email text No
(Excuse the lazy space-ugly table design. for-fixin later ;)
Heres the problem class.
class browsejobs extends renderer {
function renderbody() {
$this->retrieve_template('biggerbox.html');
$records = DG_GetRecords ('SELECT * FROM jobads');
$outv = "";
$jobad = new renderer;
$jobad->retrieve_template('jobadsummary.html');
while ($row = mysql_fetch_assoc($records)) {
$jobad->templatefields = $row;
$outv = $outv . $jobad->apply_template_br();
}
$this->templatefields['content'] = $outv;
$out=$this->apply_template_br();
return $out;
}
Ok. The problem is, it inserts all the database fields fine, except each
record inserts the 'id' field from the first record into it
ie
id=1 data="first records data"
id=1 data="second records data"
I look in the db, and thats not whats in the database, yet its whats
being sent to the renderer class (templatefields)
Any idea where I might be all wrong here? Its got me miffed!
--
"Well, I think if you say you're going to do something and don't do
it, that's trustworthiness."
-- George Bush on CNN online chat, Aug.30, 2000
RIAA Copyright notice trap: http://guild.murdoch.edu.au/~shayne/
More information about the plug
mailing list