yes my database name is communit_members and table name is modx_members
where i have ’members’ in the snippets should i just change these to ’membersmembers’
I don’t know your table-prefix for this modx-installation, but seems to be ’members’ instead of ’modx_’.
If so, then you have to change the tablename to ’membersmembers’ for getting the full tablename with $modx->getFullTableName.
thanks, will try that
have you got a good reference in setting up the table
wow, you have gotten the datas
Ok now alter the code again to
<?php
$where=(isset($region))?'region="'.$region.'" ':'';
$orderby ='name';
$result=$modx->db->select('*',$modx->getFullTableName('members'),$where,$orderby );
$rows=$modx->db->makeArray($result);
$output='<table>';
foreach ($rows as $row){
$output.='<tr>';
$output.='<td>'.$row['contact'].'</td>';
$output.='<td>'.$row['street'].'</td>';
$output.='<td>'.$row['phone'].'</td>';
$output.='<td>'.$row['email'].'</td>';
$output.='<td>'.$row['website'].'</td>';
$output.='</tr>';
}
$output.='</table>';
return $output;
?>
that’s the data that i placed in manually
just trying the setup the table correctly from the other examples in the database.
now i get...
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed - Unknown column ’name’ in ’order clause’ »
SQL: SELECT * FROM `communit_members`.`membersmembers` WHERE region="city" ORDER BY name
[Copy SQL to ClipBoard]
Parser timing
MySQL: 0.0059 s (0 Requests)
PHP: 0.0300 s
Total: 0.0359 s
sorry, change
to
there is no field ’name’ . Let’s sort to contact, ok?
this is what i have now... do i need ...
$output.=’<td>’.$row[’region’].’</td>’;
under the $output=’<table>’;
<?php
$where=(isset($region))?’region="’.$region.’" ’:’’;
$orderby =’contact’;
$result=$modx->db->select(’*’,$modx->getFullTableName(’members’),$where,$orderby );
$rows=$modx->db->makeArray($result);
$output=’<table>’;
foreach ($rows as $row){
$output.=’<tr>’;
$output.=’<td>’.$row[’region’].’</td>’;
$output.=’<td>’.$row[’suburb’].’</td>’;
$output.=’<td>’.$row[’centre’].’</td>’;
$output.=’<td>’.$row[’street’].’</td>’;
$output.=’<td>’.$row[’contact’].’</td>’;
$output.=’<td>’.$row[’phone’].’</td>’;
$output.=’<td>’.$row[’email’].’</td>’;
$output.=’<td>’.$row[’website’].’</td>’;
$output.=’</tr>’;
}
$output.=’</table>’;
return $output;
?>
yes!!!!!!!!! i can see the data when i insert it manually but it’s not going into the database from my form - any suggestions