If I have posted this in the wrong place apologies, please let me know. I didn't see a Block development forum.
I am retrieving two fields from a Mediawiki database. They are being brought in fine but due to my limited PHP skills I am having problems displaying them properly.
Here is the code:
global $user;
db_set_active('mw');
$sql2=("SELECT field1, field2 FROM mw_tablename ORDER BY field3 LIMIT 2;");
$result2=db_query($sql2);
while ($u = db_fetch_object($result2)) {
$items[]=l($u->field1, "http://www.domain/mediawiki/index.php?title=" . $u->field1);
$items[]=l($u->field2, "http://www.domain/mediawiki/index.php?title=" . $u->field2);
}
db_set_active('default');
return(theme('item_customblock', $items,"My Block Title"));
There are up to 3 records returned and I want to display them something like this:
Field1 '1st record'
field2
Field1 '2nd record'
field2
Field1 '3rd record'
field2
Field1 is the title for the record and field 2 the content. I want field 2 to be a hyperlink and field1 NOT. I can display them both as hyperlinks but I don't have the knowledge to switch off the hyperlink for the first field. Removing the hyperlink in the first $items[] line breaks the code.
Any input much appreciated,
Paul