- Moderated by:
- Support
-
- rank:
-
Freshman
- registered:
- May 2006
- Status:
- offline
- last visit:
- 15.05.06
- Posts:
- 2
I am tring to create a PHP block that accesses a mysql database, the code the I am using work fine when I run it out side of PostNuke, but when I put it in a block nothing is displayed. Am I not able to do this with a PHP block? -
- rank:
-
Steering Committee
- registered:
- December 2002
- Status:
- offline
- last visit:
- 02.12.08
- Posts:
- 13418
What is the code you are pasting into the block? (minus passwords etc of course)
--
Regards,
Simon
itbegins.co.uk - Zikula Consulting
Please read the Support Guide -
- rank:
-
Freshman
- registered:
- May 2006
- Status:
- offline
- last visit:
- 15.05.06
- Posts:
- 2
The code I am using is:
Code
$link_id = mysql_connect('localhost', '','');
if(!$link_id) die(sql_error());
mysql_select_db(CrosLex);
$result = mysql_query('SELECT year, name, email FROM webpage_alumni ORDER BY year ASC');
print <<<END
<table border="0" cellpadding="0" cellspacing="1">
<tr class="header">
<td width="40">Year</td>
<td width="200">Name</td>
<td width="150">Email</td> </tr>
end;
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
print <<<END
<tr>
<td>$row[year]</td>
<td>$row[name]</td>
<td>$row[email]</td></tr>
end;
}
echo '</table>';
mysql_free_result($result);
mysql_close($link_id);
edited by: bsnoblen, May 15, 2006 - 01:40 PM
