我创建了2个时间表,其中一个登录用户创建其客户端的连接,第二个是显示这些客户端及其客户端列表的表单详细信息以相同的登录用户。计时表显示当前登录用户创建它们的“客户端详细信息”列表
这是我放置在定制代码Chronoforms元素的代码:
<?php
defined('_JEXEC') or die();
$user =& JFactory::getUser();
$usr_id = $user->get('id');
$usr_name = $user->get('name');
echo $usr_id;
$db = &JFactory::getDBO();
$query = "SELECT * FROM crd_chronoforms_data_RepsClient WHERE cf_created_by = '$usr_id'";
$db->setQuery($query);
$data = $db->loadObjectList();
foreach($form->data['crdchronoformsdataRepsClient'] as $detail);
?>
<table>
<tr>
<th>Client</th>
<th>Contact Name</th>
<th>Contact Number</th>
<th> </th>
</tr>
<tr>
<td><?php echo $detail['cf_rep_client'];?></td>
<td><?php echo $detail['cf_rep_contact'];?></td>
<td><?php echo $detail['cf_rep_tel'];?></td>
<td><a href="index.php?option=com_chronoforms&chronoform=reps_clients&token=<?php echo $detail['cf_uid'];?>">Edit</td>
</tr>
</table>
然而,目前,所有的列表被显示在用户的登录ID#即
echo $usr_id;
我不知道我的语法已经被轰炸了。任何帮助和新鲜的眼睛都会感激。
新的错误,现在...
Fatal error: Cannot use object of type stdClass as array in /home/cardosoc/public_html/administrator/components/com_chronoforms/form_actions/custom_code/custom_code.php(19) : eval()'d code on line 26
<?php
$user = JFactory::getUser();
$usr_id = $user->id;
$usr_name = $user->username;
echo $usr_name;
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('*')
->from('#__chronoforms_data_RepsClient')
->where('cf_created_by ='. $usr_id);
$db->setQuery($query);
$data = $db->loadObjectList();
foreach($data as $detail):
?>
<table>
<tr>
<th>Client</th>
<th>Contact Name</th>
<th>Contact Number</th>
<th>Address</th>
<th> </th>
</tr>
<tr>
<td><?php echo $detail['rep_client'];?></td>
<td><?php echo $detail['rep_contact'];?></td>
<td><?php echo $detail['rep_tel'];?></td>
<td><?php echo $detail['rep_client_address'];?></td>
<td><a href="index.php?option=com_chronoforms&chronoform=reps_clients&token=<?php echo $detail['cf_uid'];?>">Edit</td>
<?php endforeach; ?>
</tr>
</table>
无论其...如果我改变
foreach($data as $detail): TO foreach($db as $detail):
我得到的响应
m m m m
foreach($ form-> data ['crdchronoformsdataRepsClient'] as $ details); – Sundar
看到'$ details'并改变了它... – MrMage