Forums | Mahara Community

Open Discussion /
plugin error show?

Conan Edogawa's profile picture
Posts: 5

09 April 2015, 11:10 PM

i building project use mahara.
i use template plugin from

copy paste them artefact/plugintemplate and install in administrator plugin. progress ok. but:

i try show database values from table which i created but no work
name table : student_database
fields: name, email
in index.php insert:

$con=mysql_connect("localhost","root","") or die ("Don’t cant database");
mysql_select_db("mahara",$con) or die ("Don’t cant database "); //student là tên database
$result=mysql_query('SELECT * FROM student_database WHERE 1');
//student_database là tên bảng

while ($row=mysql_fetch_assoc($result))



in index.tpl insert:

{section name=st loop=$students}
<table width="40%" border="1" cellspacing="4">
<td><font><b>name: </b></font></td>

it not working!!! i think error position query database .
plz check my code. help me thanks all guy

Ghada El-Zoghbi's profile picture
Posts: 121

10 April 2015, 10:25 AM

Hi Conan,

You'll need to pass the array to the template so it can display it.

In index.php, you'll need to add (after $smarty is declared towards the bottom of the file):

$smarty->assign('students', $students);

Please give it a try and let me know how you go.



Conan Edogawa's profile picture
Posts: 5

10 April 2015, 7:55 PM

sory i had already it, i think mahara not use loop as i do

Conan Edogawa's profile picture
Posts: 5

13 April 2015, 9:31 PM

i already had fixed, thanks guy! hii
{section name=st loop=$students}  change {foreach from=$students item=st} 

4 results