I've created a pretty standard output script that spits out a list from my database WHERE bv_category="Smart" and they are also ordered by subcategory+id.
All is well and good, but I'd like to further enhance this by splitting this up into separate divs so as to provide more grouping -- "visually". It's a pretty standard table at this point.
So for those with the same bv_subcategory would be placed into a separate div container. I'd style accordingly each one. Any tips on achieving this?
I tried an if within the for each, but that would insert a div for each one where as I'd want to wrap each one that has the same bv_subcategory value.
$query = "SELECT * FROM wp_products_table_ba_BV_unique";
if (! empty ( $sql_filter )) {
$query .= ' WHERE bv_category="Smart" AND ' . implode ( ' AND ', $sql_filter ) . ' ORDER BY bv_subcategory ASC, id ASC';
}
else {
$query = "SELECT * FROM wp_products_table_ba_BV_unique WHERE bv_category='Smart' ORDER BY bv_subcategory ASC, id ASC";
}
echo "SQL been Called : <br/>";
echo "<b>" . $query . "</b>";
$products = $wpdb->get_results ( $query );
$prodTable_Build = "<table id='myTable' class='display' cellspacing='0' width='100%'>";
$prodTable_Build .= "<thead class='productTableHead'>
<tr>
<th>Product Code</th>
<th>Product Name</th>
<th>Pack Size</th>
<th>Exhibit A Grain<br />OZ. Equivalent</th>
<th>Grain OZ.<br />Equivalent</th>
<th> </th>
</tr>
</thead>";
foreach ( $products as $product ) {
$bv_product_num = stripslashes ($product->bv_product_num);
$bv_product_num_fix = str_pad($bv_product_num, 5, '0', STR_PAD_LEFT);
$bv_product_iw_bulk = stripslashes ($product->bv_product_iw_bulk);
if($bv_product_iw_bulk == 1) {
$bv_product_iw_bulk = "Bulk";
}
else
$bv_product_iw_bulk = "IW";
$bv_id = stripslashes ($product->id);
$bv_wg = stripslashes ($product->bv_wg);
$bv_rf = stripslashes ($product->bv_rf);
$bv_lf = stripslashes ($product->bv_lf);
$bv_product_name = stripslashes ($product->bv_product_name);
$bv_product_flavor = stripslashes ($product->bv_product_flavor);
$bv_catering = stripslashes ($product->bv_catering);
$bv_commodity_processed = stripslashes ($product->bv_commodity_processed);
$bv_ex_a_equiv = stripslashes ($product->bv_ex_a_equiv);
$bv_ex_a_equiv = number_format((float)$bv_ex_a_equiv, 2, '.', '');
$bv_grain_equiv = stripslashes ($product->bv_grain_equiv);
$bv_grain_equiv = number_format((float)$bv_grain_equiv, 2, '.', '');
$bv_category = stripslashes ($product->bv_category);
$bv_subcategory = stripslashes ($product->bv_subcategory);
$bv_alliance = stripslashes ($product->bv_alliance);
$upload_image1 = stripslashes ($product->upload_image1);
$bv_pack_oz = (float)stripslashes ($product->bv_pack_oz);
$bv_pack_quant = stripslashes ($product->bv_pack_quant);
$bv_attached_pdf = stripslashes ($product->bv_attached_pdf);
$bv_image_main = stripslashes ($product->bv_image_main);
$bv_image_extra = stripslashes ($product->bv_image_extra);
$prod_desc = stripslashes ($product->prod_desc);
if($bv_alliance == 1) {
$alianFix = "<img src='".WP_PLUGIN_URL."/bv-product-crud/icons/alliance-icon.png' />";
}
else{
$alianFix = "";
}
if ( is_user_logged_in() ) {
$uploadimageFix = "<a href='$bv_attached_pdf' target='_blank'>PDF</a>";
} else {
$uploadimageFix = "<a href='wp-login.php'>Log In</a>";
}
$prodTable_Build .= "<tr>";
$prodTable_Build .= "<td>$bv_product_num_fix $bv_product_iw_bulk</td>";
$prodTable_Build .= "<td><b>$alianFix $bv_wg $bv_rf $bv_lf $bv_product_name</b> <!--- $bv_subcategory--></td>";
$prodTable_Build .= "<td>$bv_pack_oz oz./$bv_pack_quant</td>";
$prodTable_Build .= "<td>$bv_ex_a_equiv</td>";
$prodTable_Build .= "<td>$bv_grain_equiv</td>";
$prodTable_Build .= "<td>$uploadimageFix</td>";
$prodTable_Build .= "</tr>";
}
$prodTable_Build .= "</tbody></table>";
$prodTable_Build .= "</div>";
echo $prodTable_Build;
You get the idea
$query = "SELECT * FROM ORDER BY `bv_subcategory`";
$temp = row['bv_subCategory'];
<div>
//in loop
if($temp != row['bv_subcategory'])
{
echo "</div><div>"
$temp = $row['bv_subcategory'];
}
//after loop
</div>
Related
I try to display every each data on the specific td, but I dont know where to fix my code. Please check the screenshop below to understand the clearly problems. Please any help to solve this problems.
<table class="table table-hover table-bordered ">
<tr><th>Day</th><th colspan="2">08:00-08:40</th><th colspan="2">8:40-09:20</th><th colspan="2">09:20-10:00</th><th>10:00-10:15</th><th colspan="2">10:15-10:55</th><th colspan="2">10:55-11:35</th><th colspan="2">11:35-12:15</th><th>12:15-01:15</th><th colspan="2">01:15-01:55</th><th colspan="2">01:55-02:35</th></tr>
<?php
$timesVariants = array("08:00-08:40", "08:40-09:20", "09:20-10:00", "10:00-10:15", "10:15-10:55", "10:55-11:35", "11:35-12:15", "12:15-01:15", "01:15-01:55","01:55-02:35");
$sqlquery = "SELECT * FROM timetable,classroom,subprogramme WHERE classroom.classid = timetable.classid AND subprogramme.subid = timetable.subid";
$res = $connect->query($sqlquery);
$classes = array();
while($row = $res->fetch_assoc()) {
$classes[$row['day']][$row['tid']][$row['time']] = array('courseid'=> $row['cid'], 'classname' => $row['classname'], 'subname' => $row['subname']);
}
//This is a loop
foreach($classes as $day => $daySchedule) {
foreach($daySchedule as $teacher) {
print '<tr>';
print "<td>$day</td>";
foreach($timesVariants as $time) {
if (empty($teacher[$time])){
print "<td>*</td><td>*</td>";
}
else{
print '<td>' . $teacher[$time]['courseid'] . '</td><td>' . $teacher[$time]['subname'] . ''. $teacher[$time]['classname'] . '</td>';
}
}
print '</tr>';
}
}
?>
</table>
Output
Results display on the webpage
You trouble is in the GROUP BY. MySql have no strict restrictions (by default) that each column should use aggregation function, so the result is the first row, instead of complicating SQL use PHP, your result seems not to be huge, so another loop will not affect performance:
$timesVariants = array("08:00-08:40", "08:40-09:20", "09:20-10:00", "10:00-10:15", "10:15-10:55", "10:55-11:35", "11:35-12:15", "12:15-1:15", "01:15-01:55","01:55-02:35");
$sqlquery = "SELECT * FROM timetable";
$classes = array();
while($row = $res->fetch_assoc()) {
$classes[$row['day']][$row['tid']][$row['time']] = array('subject'=> $row['subject'], 'class' => $row['class'], 'progid' => $row['progid']);
}
//This is a loop
foreach($classes as $day => $daySchedule) {
foreach($daySchedule as $teacher) {
print '<tr>';
print "<td>$day</td>";
foreach($timesVariants as $time) {
if (empty($teacher[$time]))
print "<td>None</td><td>None</td>";
else
print '<td>' . $teacher[$time]['subject'] . '</td><td>' . $teacher[$time]['class'] . '</td>';
}
print '</tr>';
}
}
<?php
if(isset($_POST["tid"])){
$tid = $connect->real_escape_string($_POST["tid"]);
$sqlquery = "SELECT * FROM timetable,classroom,subprogramme WHERE classroom.classid = timetable.classid AND subprogramme.subid = timetable.subid AND timetable.tid = ".$tid." ORDER BY timetable.timid ASC";
$res = $connect->query($sqlquery);
if($res->num_rows > 0){
?>
<table class="table table-bordered table-striped">
<tr><th>Day</th><th colspan="2">8:00-8:40</th><th colspan="2">8:40-9:20</th><th colspan="2">9:20-10:00</th><th colspan="2">10:00-10:15</th><th colspan="2">10:15-10:55</th><th colspan="2">10:55-11:35</th><th colspan="2">11:35-12:15</th><th colspan="2">12:15-1:15</th><th colspan="2">1:15-1:55</th><th colspan="2">1:55-2:35</th></tr>
<?php
$timesVariants = array("8:00-8:40", "8:40-9:20", "9:20-10:00", "10:00-10:15", "10:15-10:55", "10:55-11:35", "11:35-12:15", "12:15-01:15", "1:15-1:55","1:55-2:35");
$classes = array();
while($row = $res->fetch_assoc()) {
$classes[$row['day']][$row['tid']][$row['time']] = array('courseid'=> $row['cid'], 'classname' => $row['classname'], 'subname' => $row['subname']);
}
//This is a loop
foreach($classes as $day => $daySchedule) {
foreach($daySchedule as $teacher) {
print '<tr>';
print "<td>$day</td>";
foreach($timesVariants as $time) {
if (empty($teacher[$time])){
print "<td>*</td><td>*</td>";
}
else{
print '<td>' . $teacher[$time]['courseid'] . '</td><td>' . $teacher[$time]['subname'] . ''. $teacher[$time]['classname'] . '</td>';
}
}
print '</tr>';
}
}
?>
</table>
<?php
}
else{ print "<div class='alert alert-danger col-md-4'><span class='glyphicon glyphicon-remove'></span> Not yet set timetable</div>"; }
} ?>
</div>
The problems was on td I forgot to put colspan = 2, and other problem on sql query I forgot to inner join the tables in order to get all right that i want to display on the page.
the situation I am facing is like that:
I read data from a database and dump them into a table in a webpage. And then, according to a column's value, show a drop-down list or not. And write the value from the drop-down list back into the database.
I use ...Submit, but the $_GET has no values about the drop-down list.
I list the whole code set here.
Any help is highly appreciated!
$GCdataSQL = "select * from table_name";
$GCdata = new Query($GCdataSQL);
$table = "<form method='GET'><table class='datatable table table-condensed ' id='query-data'><thead><tr>";
$ColName = array('col1','col2','col3','col4', 'col5', 'col6', 'col7', 'col8');
foreach ($ColName as $Name){
$table .= "<th>$Name</th>";
}
$table .= "</tr></thead><tbody>";
while ($GCdataRow = $GCdata->fetchRow()){
$emplid = $GCdataRow['emplid'];
$term = $GCdataRow['term'];
$handled = $GCdataRow['handled'];
if ($GCdataRow['code'] == 'UNKNOW' || $GCdataRow['code'] == 'Not Repeated'){$GCdataRow['code']= '';}
if ($GCdataRow['local_action'] !== $GCdataRow['new_action']){
$table .= "<tr bgcolor= 'LightPink'>";
}
else {
$table .= "<tr>";
}
foreach($GCdataRow as $key=>$value){
if ($key == 'emplid'){
$table .="<td><a href='link' target = '_blank'>$value</a></td>";
}
else if ($key == 'new_action'){
$table .="<td><a href='link' target = '_blank'>$value</a></td>";
}
else if ($key == 'handled' && $handled == 'Not Reviewed'){
$table .="<td><select name = 'handlecode'><option value = 'Not Reviewed'>Not Reviewed</option><option value = 'Handled by Script'>Handled by Script</option><option value = 'Handled Manually'>Handled Manually</option><option value = 'Leave It'>Leave It</option></select></td>";
}
else {
$table .= "<td>".htmlentities($value)."</td>";
}
}
$table .= "</tr>";
$loopcount++;
}
if(isset($table)) {$table .= "</tbody></table>";}
echo $table;
echo "<button type='submit' class = 'btn btn-primary' style = 'position: absolute; left:50%;' >Submit</button></form>";
finally I changed the form method to POST, and everything is fine! Now the values are in $_POST, and I could use them to insert into the database!
Thank you!
I am trying to create a Dropdown Menu on my site, Ive hit a brick wall and cannot think on how to do it.
Basically i need to check 2-3 variables in a database and out put the correct data.
I have at the moment it checking if its an External Link or Not, and if it contains a submenu, but i can't get it to output the correct information.
Basically i want it to check if its a External or Non-External link, and if it has a submenu, if it has a submenu, to display the menu options underneath it. So say i have menu 1, 2 ,3, 4 and 2,4 has a submenu, i need them to list the other links under them. i have put in my database toplink_id (to represent which link this item should be under) sc_order (which will control the order the sublinks display in) also dropdown (which tells me if the menu has a submenu or not.)
Here is the start of my code
$sql = "SELECT label, url, ext, dropdown FROM content_pages WHERE top_nav='1' AND active='1' ORDER by page_order ASC";
$query = mysqli_query($dbc, $sql) or die (mysqli_error($dbc));
$menuDisplay .= '<div class="bg-2"><div class="container_12"><article class="grid_12"><nav><ul class="menu sf-js-enabled">';
while ($row = mysqli_fetch_array($query)) {
$url = $row["url"];
$nav_label = $row["label"];
$drop_down ='<ul><li>' . $nav_label . '</li></ul>';
if ($row["ext"] == 0 && $row["dropdown"] == 1){
$menuDisplay .= '<li>' . $nav_label . '' . $drop_down . '</li>';
}
elseif ($row["ext"] == 1 && $row["dropdown"] == 1){
$menuDisplay .= '<li>' . $nav_label . '' . $drop_down . '</li>';
}
elseif ($row["ext"] == 0){
$menuDisplay .= '<li>' . $nav_label . '</li>';
}
elseif ($row["ext"] == 1)
{
$menuDisplay .= '<li>' . $nav_label . '</li>';
}
}
$menuDisplay .= '</ul></nav></article></div></div></header>';
mysqli_free_result($query);
Best way I found to do this without using jQuery is use multidimensional Arrays.
// Create a multidimensional array to conatin a list of items and parents
$menu = array(
'items' => array(),
'parents' => array(),
);
// Builds the array lists with data from the menu table
while ($items = mysqli_fetch_assoc($query))
{
// Creates entry into items array with current menu item id ie. $menu['items'][1]
$menu['items'][$items['id']] = $items;
// Creates entry into parents array. Parents array contains a list of all items with children
$menu['parents'][$items['parent']][] = $items['id'];
}
// Menu builder function, parentId 0 is the root
function buildMenu($parent, $menu)
{
$html = "\n";
if ( isset($menu['parents'][$parent]) )
{
$html .= "";
foreach ($menu['parents'][$parent] as $itemId)
{
if(!isset($menu['parents'][$itemId]) && $menu['items'][$itemId]['ext'] == 0)
{
$html .= "<li>\n <a href='../pages/".$menu['items'][$itemId]['link']."'>".$menu['items'][$itemId]['label']."</a>\n</li> \n";
}
else
if(!isset($menu['parents'][$itemId]) && $menu['items'][$itemId]['ext'] == 1)
{
$html .= "<li>\n <a href='../".$menu['items'][$itemId]['link']."'>".$menu['items'][$itemId]['label']."</a>\n</li> \n";
}
if(isset($menu['parents'][$itemId]))
{
$html .= "<li>\n <a href='../pages/".$menu['items'][$itemId]['link']."'>".$menu['items'][$itemId]['label']."<span class='arrow-down'></span></a> \n";
$html .= "<ul style='border-radius: 0px 0px 6px 6px'> \n";
$html .= buildMenu($itemId, $menu);
$html .= "</ul> \n";
$html .= "</li> \n";
}
}
$html .= "\n";
}
$html .= "";
return $html;
}
I'm stuck on a piece of code that calls a jQuery modul populated with a table row id. I'm about 90% sure that the error is within my jQuery code. Once I click on the button (class="view"), I get an undefined value instead of the row ID.
Thanks for any help!
Relevant section of leads_queue_a.php:
<section class="main">
<h1>Lead Queue - Assigned Leads</h1>
<div id="lead_wrapper_a"></div>
</section>
fill_leads_a.php:
$cond = array();
$params = array();
if ($_POST['id'] == '') {
return;
}
if (isset($_POST['id']) && $_POST['id'] != '') {
$userID = $_POST['id'];
}
if (!empty($userID)) {
$cond[] = '`users`.`id` = ?';
$params[] = "$userID";
}
$query = "SELECT `leads`.`id`, `leads`.`fname`, `leads`.`lname`, `leads`.`lead_type`, `leads`.`addr_street`, `leads`.`addr_city`, `leads`.`addr_zip`, `leads`.`phone`, `leads`.`phone_alt`, `leads`.`note`, `leads`.`created_by`, `leads`.`created` FROM `leads`,`users`,`leads_assignment`";
if (count($cond)) {
$query .= ' WHERE ' . implode(' AND ', $cond);
}
$query .= ' AND `leads`.`id` = `leads_assignment`.`id_lead`'
. ' AND `users`.`id` = `leads_assignment`.`id_user`';
$stmt = $db->prepare($query);
$stmt->execute($params);
//TABLE BUILDER
$lead = '';
$lead .= '<div class="leads">';
$lead .= '<table class="lead_table">';
$lead .= '<tr>';
$lead .= '<td>Customer</td>';
$lead .= '<td>Phone</td>';
$lead .= '<td>Lead Type</td>';
$lead .= '<td>Status</td>';
$lead .= '<td>Operations</td>';
$lead .= '</tr>';
foreach ($stmt->fetchAll(PDO::FETCH_OBJ) as $row) {
$id = $row->id;
$status = get_statusLast($id);
$fname = $row->fname;
$lname = $row->lname;
$lead_type = $row->lead_type;
$addr_street = $row->addr_street;
$addr_city = $row->addr_city;
$addr_zip = $row->addr_zip;
$phone = $row->phone;
$phone_alt = $row->phone_alt;
$note = $row->note;
$created_by = $row->created_by;
$created = $row->created;
$lead .= "<tr id='$id'>";
$lead .= '<td>' . $fname . ' ' . $lname . '<br />' . $addr_street . '<br />' . $addr_city . ' ' . $addr_zip . '</td>';
$lead .= '<td>' . $phone . '<br />' . $phone_alt . '</td>';
$lead .= '<td>' . $lead_type . '</td>';
$lead .= '<td>' . $status . '</td>';
$lead .= '<td><button type="button" class="view" name="view">View Notes</button><br />'
. '<button type="button" class="update" name="update">Update Status</button></td>';
}
$lead .= '</table>';
$lead .= '</div>';
$db = null;
print $lead;
Relevent section of modul.js:
$("#lead_wrapper_a").on('click', '.view', function() {
alert($('tr', this).attr('id'));
});
Because your selction is incorrect. Use closest to get to the clicked buttons parent row (tr). Using the syntax $('tr', this) you are trying to find tr that are descendant of the button .view which is incorrect. You need to go upwards to get to the tr. this in the handler will be the button.
alert($(this).closest('tr').attr('id'));
You are trying to search row tr in descendant of button but button is descendant of row tr. You probably need closest() to get the ancestor row, to get the parent row of button having class view.
$("#lead_wrapper_a").on('click', '.view', function() {
alert($(this).closest('tr').attr('id'));
});
You cant find tr within the context of this, Because tr is the ancestor of the source button in your case. So you have to use .closest() to achieve the desired result.
Try,
$("#lead_wrapper_a").on('click', '.view', function() {
$( "#dialog_view" ).dialog( "open" );
alert($(this).closest('tr').attr('id'));
});
when it comes to table its bit tricky.
for your first line you want to select the entire path of class "view". I dont know your exact path but it should be someting like this.
$("#lead_wrapper_a").on('click', '"#lead_wrapper_a > table > tbody > tr > td.view', function() {
});
Hope this helps
I have created a CheckModulePermission function in my user class which checks a module table to ensure the user has permissions to view the page. Below is the function
public function CheckModulePermissions($moduleId) {
if(isset($_SESSION['userId'])) {
// If the user is admin, allow regardless
if($this->IsAdmin()) {
return true;
}
$sql = "SELECT `userModuleId`
FROM `userModules`
WHERE `userId` = " . $_SESSION['userId'] . "
AND `moduleId` = " . $moduleId . ";";
mysql_select_db(DB_USER_DATABASE_NAME, $this->conn);
$result = mysql_query($sql, $this->conn);
$x = mysql_fetch_row($result);
if($x[0] == 1) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
This works fine in all my pages except one page where it fails . I have a dropdown box and a text box which will be updated depending on the users permission. The user i am logged on as has the permission but the dropdown boxes do not appear.
if(isset($_GET['orderNumber'])) {
// If post is set then update the prima reference and order status
// Only if user has sufficient privileges
if(isset($_POST['orderStatus'])) {
if($user->CheckModulePermissions(11)) {
$cid->UpdateOrderStatus($_GET['orderNumber'], $_POST['orderStatus']);
$cid->UpdateOrderReference($_GET['orderNumber'], $_POST['PReference']);
}
}
if($user->CheckModulePermissions(11)) {
$content .= "<select name='orderStatus'>
<option value='1'";
if($orderDetails['status'] == 1) $content .= " selected='selected'";
$content .= ">Incomplete</option>
<option value='2'";
if($orderDetails['status'] == 2) $content .= " selected='selected'";
$content .= ">Submitted</option>
<option value='3'";
if($orderDetails['status'] == 3) $content .= " selected='selected'";
$content .= ">Processed</option>
</select>";
} else {
if($orderDetails['status'] == 1) $content .= "Incomplete";
if($orderDetails['status'] == 2) $content .= "Submitted";
if($orderDetails['status'] == 3) $content .= "Processed";
}
$content .= "</td>
</tr>
<tr>
<th>Prima Order Number</th>
<td>";
if($user->CheckModulePermissions(11)) {
$content .= "<input type='text' name='pReference' value='" . $orderDetails['PReference'] . "' /></td>
</tr>
<tr>
<td colspan='2'><input type='submit' /></td>
</tr>";
} else {
$content .= $orderDetails['PrimaReference'] . "</td></tr>";
}
$content .= "</table>
</form>
</td>
Is it the logic for the dropdown box where it fails?
Here is a more efficient/readable version of your CheckModulePermissions() method...
public function CheckModulePermissions ($moduleId) {
// Deny immmediately if no userId is set
if (!isset($_SESSION['userId'])) return FALSE;
// If the user is admin, allow regardless
if ($this->IsAdmin()) return TRUE;
// Generate an SQL statement - does this need sanitising?
$sql = "SELECT `userModuleId`
FROM `userModules`
WHERE `userId` = '{$_SESSION['userId']}'
AND `moduleId` = '$moduleId'
LIMIT 1";
// Is this line really necessary? Are you actually working with more than one database?
// Even if you are, it's probably better to do it in the query, like this:
// SELECT whatever FROM DB_USER_DATABASE_NAME.tablename WHERE...
mysql_select_db(DB_USER_DATABASE_NAME, $this->conn);
// Since you only want one row, it's slightly more resource efficient
// to abandon the $result variable
$x = mysql_fetch_row(mysql_query($sql, $this->conn));
// This means the same thing as your if ... else
return $x[0] == 1;
}
...and here is a rewritten version of the HTML generation code.
// Get this once, at the beginning, to minimise SQL traffic
$hasPermissions = $user->CheckModulePermissions(11);
// Uncomment this line to make sure that $user->CheckModulePermissions is returning the value you expect
//var_dump($hasPermissions);
if (isset($_GET['orderNumber'])) {
// If post is set then update the prima reference and order status
// Only if user has sufficient privileges
if (isset($_POST['orderStatus']) && $hasPermissions) {
$cid->UpdateOrderStatus($_GET['orderNumber'], $_POST['orderStatus']);
$cid->UpdateOrderReference($_GET['orderNumber'], $_POST['PReference']);
}
// Map of status numbers to string descriptions
$statusStrs = array(1 => 'Incomplete','Submitted','Processed');
if ($hasPermissions) {
// Generate a <select>
$content .= "<select name='orderStatus'>";
foreach ($statusStrs as $val => $str) {
$content .= "\n<option value='$val'".(($orderDetails['status'] == $val) ? " selected='selected'" : '').">$str</option>";
}
$content .= "\n</select>";
} else {
// Print the current status string
$content .= $statusStrs[$orderDetails['status']];
}
// Close the table cell (layout tables are nasty nasty)
$content .= "</td>
</tr>
<tr>
<th>Prima Order Number</th>
<td>";
if ($hasPermissions) {
// add an input for changing the reference number
$content .= "<input type='text' name='pReference' value='{$orderDetails['PReference']}' /></td>
</tr>
<tr>
<td colspan='2'><input type='submit' /></td>
</tr>";
} else {
// Display the current reference number
$content .= $orderDetails['PrimaReference'] . "</td></tr>";
}
$content .= "</table>
</form>
</td>
I think the most likely cause of your problem is that CheckModulePermissions() is returning FALSE when you expect it to return TRUE. Uncomment the var_dump() line to verify this and we'll take it from there.