Hi,
I have a table that is updated by the users. I want to create a grid for the users to view their entries. And only their entries.
I got the table to show, but I don't know how to get the table to only show the entries from the user that's viewing it.
I the codes below But it doesn't work. But it doesn't work. The cm_request_items table stores the Joomla id (user_id) as SNS62.
- WHERE SQL:
- HEADER:
- BODY:
- FOOTER:
I tried using this in the WHERE SQL codes now. Since the form they use to populate the cm_request_items table adds the Name, Email and User ID from Joomla user table (and can't be changed by the user).
Any help on this would be well appreciated. Thanks in advanced.
Best Regards,
Winchester
I have a table that is updated by the users. I want to create a grid for the users to view their entries. And only their entries.
I got the table to show, but I don't know how to get the table to only show the entries from the user that's viewing it.
I the codes below But it doesn't work. But it doesn't work. The cm_request_items table stores the Joomla id (user_id) as SNS62.
- WHERE SQL:
<?php
$db =& JFactory::getDBO();
$user = &JFactory::getUser();
$id = "SNS".$user->id;
$email = $user->email;
$query = "SELECT * FROM cm_request_items WHERE SNSID=$id AND Email=$email";
echo = $query;
$db->setQuery($query);
$result = $db->loadObject();
?>
- HEADER:
<table class="sns-table account-history">
<tr>
<th>Date</th><th>URL</th><th>Desc</th><th>Qty</th><th>Unit Cost</th><th>Sales Tax</th><th>Shipping</th><th>Total</th><th>Weight</th><th>Size</th>
</tr>
- BODY:
<tr>
<td>{Date}</td>
<td><a href="{ItemURL}" target="_blank">View Item</a></td>
<td><a onclick="return false;" class="tooltiplink"><img width="16" height="16" border="0" src="/components/com_chronocontact/css/images/tooltip.png" alt="" class="tooltipimg"></a>
<div class="tooltipdiv">Description :: {ItemDesc}</div></td>
<td>{ItemQty}</td>
<td>{ItemCost}</td>
<td>{ItemTax}</td>
<td>{ItemShipCost}</td>
<td>{ItemTotalCost}</td>
<td>{ItemWeight} lb</td>
<td>{ItemLength}x{ItemWidth}x{ItemHeight}</td>
</tr>
- FOOTER:
</table>
<div class="cc_pag">{pagination}</div>
I tried using this in the WHERE SQL codes now. Since the form they use to populate the cm_request_items table adds the Name, Email and User ID from Joomla user table (and can't be changed by the user).
<?php
$db =& JFactory::getDBO();
$user = &JFactory::getUser();
$email = $user->email;
$query = "SELECT * FROM cm_request_items WHERE Email=$email";
echo = $query;
$db->setQuery($query);
$result = $db->loadObject();
?>
Any help on this would be well appreciated. Thanks in advanced.
Best Regards,
Winchester