Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL Error


ce7

Recommended Posts

Posted

Hi there,

 

It will be highly appreciated if someone could help me to figure out my problem.

 

Please don't send me advertising Email for pay job to fix my problem.

I don't have budget and I am trying to learn PHP and SQL through the errors. Thanks.

 

I tried to modified Information Page Unlimited to Staff Page,

 

and I got this error message:

 

1054 - Unknown column 'staff_group_id' in 'where clause'

 

select * from information where language_id = '1' and staff_group_id = '1' order by sort_order

 

 

Please find the php files related as below

===============================================================================

admin/staff_list.php

===============================================================================

 

<?php

?>
   <tr class="pageHeading"><td><?php echo $title; ?></td></tr>
   <tr>
  <td><table border="0" width="100%" cellpadding="2" cellspacing="1" bgcolor="#ffffff">
    <tr class="dataTableHeadingRow">
	  <td align="center" class="dataTableHeadingContent"><?php echo ID_STAFF; ?></td>
	  <td align="center" class="dataTableHeadingContent"><?php echo ENTRY_TITLE; ?></td>
	  <td align="center" class="dataTableHeadingContent"><?php echo ENTRY_PARENT_PAGE; ?></td>
	  <td align="center" class="dataTableHeadingContent"><?php echo PUBLIC_STAFF; ?></td>
	  <td align="center" class="dataTableHeadingContent"><?php echo ENTRY_SORT_ORDER; ?></td>
	  <td align="center" class="dataTableHeadingContent" colspan="2"><?php echo ACTION_STAFF; ?></td>
    </tr>
<?php
  $no = 1;
  if (sizeof($data) > 0) {
    while (list($key, $val) = each($data)) {
	  $no % 2 ? $bgcolor="#DEE4E8" : $bgcolor="#F0F1F1";
?>
    <tr bgcolor="<?php echo $bgcolor; ?>">
	  <td align="center" class="dataTableContent"><?php echo $val['staff_id']; ?></td>
	  <td width="40%" class="dataTableContent"><?php echo $val['staff_title']; ?></td>
	  <td align="center" class="dataTableContent"><?php echo ((!empty($val['stafparent_id'])) ? $val['stafparent_id'] : null); ?></td>
	  <td align="center" class="dataTableContent" nowrap="nowrap">
<?php
	  if ($val['visible'] == 1) {
	    echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . ' ';
	    echo ((!strstr($staf_group['locked'], 'visible')) ? '<a href="' . tep_href_link(FILENAME_STAFF_MANAGER, "gID=$gID&staff_action=Visible&staff_id=$val[staff_id]&visible=0") . '">' : null);
	    echo tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', DEACTIVATION_ID_STAFF . " $val[staff_id]", 10, 10);
	    echo ((!strstr($staf_group['locked'], 'visible')) ? '</a>' : null);
	  } else {
	    echo ((!strstr($staf_group['locked'], 'visible')) ? '<a href="' . tep_href_link(FILENAME_STAFF_MANAGER, "gID=$gID&staff_action=Visible&staff_id=$val[staff_id]&visible=1") . '">' : null);
	    echo tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', ACTIVATION_ID_STAFF . " $val[staff_id]", 10, 10);
	    echo ((!strstr($staf_group['locked'], 'visible')) ? '</a>' : null);
	    echo ' ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
	  }
?></td>
	  <td width="10%" align="center" class="dataTableContent"><?php echo $val['sort_order']; ?></td>
	  <td align="center" class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_STAFF_MANAGER, "gID=$gID&staff_action=Edit&staff_id=$val[staff_id]", 'NONSSL') . '">' . tep_image(DIR_WS_ICONS . 'edit.gif', EDIT_ID_STAFF . " $val[staff_id]") . '</a>'; ?></td>
<?php
	  if (empty($staf_group['locked'])) {
	    echo '<td align="center" class="dataTableContent"><a href="' . tep_href_link(FILENAME_STAFF_MANAGER, "gID=$gID&staff_action=Delete&staff_id=$val[staff_id]", 'NONSSL') . '">' . tep_image(DIR_WS_ICONS . 'delete.gif', DELETE_ID_STAFF . " $val[staff_id]") . '</a></td>';
	  }
?>
    </tr>
<?php
	  $no++;
    }
  } else {
?>
    <tr bgcolor="#DEE4E8">
	  <td colspan="7" class="dataTableContent"><?php echo ALERT_STAFF; ?></td>
    </tr>
<?php
   }
?>
  </table></td>
   </tr>
   <tr>
  <td align="right">
<?php
   if (empty($staf_group['locked'])) {
    echo tep_draw_button(IMAGE_NEW_PAGE, 'document', tep_href_link(FILENAME_STAFF_MANAGER, 'gID=' . $gID . '&staff_action=Added'));
   }
   echo tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_STAFF_MANAGER, 'gID=' . $gID));
?></td>
   </tr>

 

===============================================================================

admin/staff_form.php

===============================================================================

<?php
?>
   <tr>
  <td class="pageHeading"><?php echo $title; ?></td>
   </tr>
   <tr>
   <td>
<table border="0" cellpadding="0" cellspacing="2" width="100%">
<?php
  if (!strstr($staf_group['locked'], 'visible')) {
?>
    <tr>
	  <td class="main"><?php echo ENTRY_STATUS; ?></td>
	  <td class="main"><?php echo tep_draw_radio_field('visible', '1', true, $edit['visible']) . '  ' . STATUS_ACTIVE . '  ' . tep_draw_radio_field('visible', '0', false, $edit['visible']) . '  ' . STATUS_INACTIVE; ?></td>
    </tr>
    <tr>
	  <td colspan="2" height="10"> </td>
    </tr>
<?php
  }
  if (!strstr($staf_group['locked'], 'stafparent_id')) {
?>
    <tr>
	  <td class="main"><?php echo ENTRY_PARENT_PAGE; ?></td>
	  <td class="main">
<?php
	  if ((sizeof($data) > 0)) {
	    $options = '<option value="0">-</option>';
	    reset($data);
	    while (list($key, $val) = each($data)) {
		  $selected = ($val['staff_id'] == $edit['stafparent_id']) ? 'selected="selected"' : '';
		  $options .= '<option value="' . $val['staff_id'] . '" ' . $selected . '>' . $val['staff_title'] . '</option>';
	    }
	    echo '<select name="stafparent_id">' . $options . '</select>';
	  } else {
	    echo '<span class="messageStackError">' . WARNING_PARENT_PAGE .'</span>';
	  }
?> 
	 </td>
    </tr>
    <tr>
	  <td colspan="2" height="10"> </td>
    </tr>
<?php
  }
  if (!strstr($staf_group['locked'], 'sort_order')) {
?>
    <tr>
	  <td class="main"><?php echo ENTRY_SORT_ORDER; ?></td>
	  <td><?php
		 if ($edit['sort_order']) {
		    $no = $edit['sort_order'];
		 }
		 echo tep_draw_input_field('sort_order', "$no", 'size=3 maxlength=4');
?>
	  </td>
    </tr>
    <tr>
	  <td colspan="2" height="10"> </td>
    </tr>
<?php
 }

 if (!strstr($staf_group['locked'], 'staff_description')) {
?>	
<!-- tabs  -->
   <tr>
   <td>
   <div id="tab_descrip" class="ui-tabs">
   <table border="0" width="100%" cellspacing="0" cellpadding="0">
  <ul>
	   <?php
   //$languages = tep_get_languages();
		 for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
	   ?>
   <li><a href="#<?php echo $languages[$i]['name'];?>"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?><?php echo "  " . $languages[$i]['name'];?></a></li>
 <?php
   }
 ?>
  </ul>

  <tr>
  <td>

  <?php
  //$languages = tep_get_languages();
	    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
		   $languages_id=$languages[$i]['id'];  	
	 ?>
	   <div id="<?php echo $languages[$i]['name'];?>" class="ui-tabs" >
		  <table border="0" cellspacing="0" cellpadding="2" align="left">
			    <tr>
				  <td>
   <table border="0" cellspacing="0" cellpadding="2"> 
				   <tr>
    <?php if (!strstr($staf_group['locked'], 'staff_title')) { ?>	   
					  <td class="main"><?php echo ENTRY_TITLE ?></td>
					  <td align="left" class="main"><?php echo tep_draw_input_field('staff_title[' . $languages[$i]['id'] . ']', (isset($staff_title[$languages[$i]['id']]) ? stripslashes($edit[staff_title]) : tep_get_staff_entry($staff_id, $languages[$i]['id'], 'staff_title')), 'maxlength=255 size=75'); ?></td>
				   <?php } ?>	   
				    </tr>	   
				    <tr>
  <td class="main"><?php echo ENTRY_TEXT ; ?></td>
				    <td class="ui-widget-content">
				    <?php 
  // how to fix the fatal error
  // original code: tep_draw_textarea_ckeditor('staff_description[' . $languages[$i]['id'] . ']', '', '140', '80', (isset($staff_description[$languages[$i]['id']]) ? stripslashes($edit[staff_description]) : tep_get_staff_entry($staff_id, $languages[$i]['id'], 'staff_description')));  
  // code to fix, add: )), 'class="ckeditor"'
					  echo tep_draw_textarea_field('staff_description[' . $languages[$i]['id'] . ']', '', '140', '80', (isset($staff_description[$languages[$i]['id']]) ?stripslashes($edit[staff_description]) : tep_get_staff_entry($staff_id, $languages[$i]['id'], 'staff_description')), 'class="ckeditor"');	  
				   ?>
				   </td>	  
				   </tr>
				  </table>
   </td>
			    </tr>	
	   </table>
    </div>
  <?php
 }
  ?>
  </td>
  </tr>

 </table>
 </div>
 </td>
 </tr>

<!-- tabs -->  
<?php
   }
?>
   <tr>
   <td colspan="2" align="left"><br /><?php
  // Decide when to show the buttons (Determine or 'locked' is active)
  if ((empty($staf_group['locked'])) || ($_GET['staff_action'] == 'Edit')) {
    echo tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary');
  } else {
    echo tep_draw_button(IMAGE_INSERT, 'plus', null, 'primary');
  }
  echo tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_STAFF_MANAGER, 'gID=' . $gID));
?>
   </td>
   </tr>
<script>
<!--   bof sub tabs product description  -->
   $(function() {
 $( "#tab_descrip" ).tabs( ) ;
});
</script>
<!-- eof tabs ui -->   
   </table>
   </td> 
   </tr>
   </form>

===============================================================================

staff_manager.php

===============================================================================

<?php
/*

*/
// WTL - this goes in admin
 require('includes/application_top.php');
// Include current language file, if not exists, fall use English (Why is this not a standard procedure in OsCommerce?)
 if (file_exists(DIR_WS_LANGUAGES . $language . '/staff.php')) {
   include(DIR_WS_LANGUAGES . $language . '/staff.php');
 } else {
   include(DIR_WS_LANGUAGES . 'english/staff.php');
 }
 $languages = tep_get_languages();
 $action = (isset($_REQUEST['staff_action']) ? $_REQUEST['staff_action'] : '');
// Group staff
 $gID = (isset($_GET['gID'])) ? $_GET['gID'] : ((isset($_POST['gID'])) ? $_POST['gID'] : 1);
 $staf_group_query = tep_db_query("select staff_group_title, locked from " . TABLE_STAFF_GROUP . " where staff_group_id = '" . (int)$gID . "'");
 $staf_group = tep_db_fetch_array($staf_group_query);
//$staf_group['locked'] = ''; // DEBUG, to ignore locked fields
// WTL - Removed for testing 11/19/07
// Create additional staff records for unknown languages
// NOTE: This is a function with some overhead, but is needed as this is an add-on
//	   and the new languages are not automatically generated by languages.php
 function tep_update_staff_languages($language_id = 0) {
   global $languages, $languages_id, $gID;
   if ($language_id == 0) $language_id = $languages_id;
   // Count all items
   $staff_query = tep_db_query("select count(*) as staff_count from " . TABLE_STAFF. " where staff_group_id = '" . (int)$gID . "'");
   $staff = tep_db_fetch_array($staff_query);
   $staff_count_all = $staff['staff_count'];
   // Count items for main language
   $staff_query = tep_db_query("select count(*) as staff_count from " . TABLE_STAFF . " where staff_group_id = '" . (int)$gID . "' and language_id = '" . (int)$language_id . "'");
   $staff = tep_db_fetch_array($staff_query);
   $staff_count_single = $staff['staff_count'];
   if ($staff_count_all != $staff_count_single * sizeof($languages)) {
  // Create array of language id's in staff table
  $staff_query = tep_db_query("select language_id from " . TABLE_STAFF . " where staff_group_id = '" . (int)$gID . "' group by language_id");
  while ($staff_language = tep_db_fetch_array($staff_query)) {
    $staff_languages[] = $staff_language['language_id'];
  }
  // Create array of language id's in languages
  foreach($languages as $language) {
    $languages_ids[] = $language['id'];
  }
  // Remove entries with languages no longer being used
  foreach($staff_languages as $_language_id) {
    if (!in_array($_language_id, $languages_ids)) {
	  tep_db_query("delete from " . TABLE_STAFF . " where staff_group_id = '" . (int)$gID . "' and language_id = '" . (int)$_language_id . "'");
    }
  }
  $staff_query = tep_db_query("select * from " . TABLE_STAFF . " where staff_group_id = '" . (int)$gID . "' and language_id = '" . (int)$language_id . "'");
  while ($staff = tep_db_fetch_array($staff_query)) {
    foreach($languages_ids as $_language_id) {
	  if (!in_array($_language_id, $staff_languages)) {
	    $sql_data_array = array(
		  'language_id'			 => $_language_id,
		  'visible'				 => tep_db_prepare_input($staff['visible']),
		  'sort_order'			  => tep_db_prepare_input($staff['sort_order']),
		  'staff_id'		  => tep_db_prepare_input($staff['staff_id']),
		  'staff_group_id'    => tep_db_prepare_input($staff['staff_group_id']),
		  'staff_title'	   => tep_db_prepare_input($staff['staff_title']),
		  'staff_description' => tep_db_prepare_input($staff['staff_description'])
	    );
	    tep_db_perform(TABLE_STAFF, $sql_data_array);
	  }
    }
  }
   }
 }
 function tep_get_staff_list($language_id = 0) {
   global $languages_id, $gID;
   if ($language_id == 0) $language_id = $languages_id;
   $staff_query = tep_db_query("select * from " . TABLE_STAFF . " where language_id = '" . (int)$language_id . "' and staff_group_id = '" . (int)$gID . "' order by sort_order");
   $c = 0;
   while ($buffer = tep_db_fetch_array($staff_query)) {
  $result[$c] = $buffer;
  $c++;
   }
   return $result;
 }
// WT
 function tep_get_staff_entry($staff_id, $language_id = 0, $column = '') {
   global $languages_id;
   if ($language_id == 0) $language_id = $languages_id;
   $staff_query = tep_db_query("select * from " . TABLE_STAFF . " where staff_id = '" . (int)$staff_id . "' and language_id = '" . (int)$language_id . "'");
   $staff = tep_db_fetch_array($staff_query);
   if (!empty($column)) return $staff[$column];
   else return $staff;
 }
 function error_message($error) {
   $warning = tep_image(DIR_WS_ICONS . 'warning.gif', WARNING_STAFF);
   switch ($error) {
  case "20": return '<tr class="messageStackError"><td>$warning ' . ERROR_20_STAFF . '</td></tr>'; break;
  case "80": return '<tr class="messageStackError"><td>$warning ' . ERROR_80_STAFF . '</td></tr>'; break;
  default: return $error;
   }
 }
 switch($action) {
   case "AddSure":
  $language_id = $languages[0]['id']; // First insert the 1st known language
  $sql_data_array = array(
    'language_id' => $language_id,
    'staff_group_id' => tep_db_prepare_input($gID)
  );
  if (isset($_POST['visible']))
    $sql_data_array['visible'] = tep_db_prepare_input($_POST['visible']);
  if (isset($_POST['sort_order']))
    $sql_data_array['sort_order'] = tep_db_prepare_input($_POST['sort_order']);
  if (isset($_POST['stafparent_id']))
    $sql_data_array['stafparent_id'] = tep_db_prepare_input($_POST['stafparent_id']);
  if (isset($_POST['staff_title']))
    $sql_data_array['staff_title'] = tep_db_prepare_input($_POST['staff_title'][$language_id]);
  if (isset($_POST['staff_description']))
    $sql_data_array['staff_description'] = tep_db_prepare_input($_POST['staff_description'][$language_id]);
  tep_db_perform(TABLE_STAFF, $sql_data_array);
  $staff_id = tep_db_insert_id();
  for ($i=1, $n=sizeof($languages); $i<$n; $i++) {
    $language_id = $languages[$i]['id'];
    $sql_data_array = array(
	  'staff_id' => $staff_id,
	  'language_id' => $languages[$i]['id'],
	  'staff_group_id' => tep_db_prepare_input($gID)
    );
    if (isset($_POST['visible']))
	  $sql_data_array['visible'] = tep_db_prepare_input($_POST['visible']);
    if (isset($_POST['sort_order']))
	  $sql_data_array['sort_order'] = tep_db_prepare_input($_POST['sort_order']);
    if (isset($_POST['stafparent_id']))
	  $sql_data_array['stafparent_id'] = tep_db_prepare_input($_POST['stafparent_id']);
    if (isset($_POST['staff_title']))
	  $sql_data_array['staff_title'] = tep_db_prepare_input($_POST['staff_title'][$language_id]);
    if (isset($_POST['staff_description']))
	  $sql_data_array['staff_description'] = tep_db_prepare_input($_POST['staff_description'][$language_id]);
    if (count($sql_data_array) > 1) {
	  if (tep_db_perform(TABLE_STAFF, $sql_data_array)) {
	    $messageStack->add_session(SUCCED_STAFF . ADD_QUEUE_STAFF, 'success');
	  } else {
	    $messageStack->add_session(ERROR_ADDING, 'error');
	  }
    }
  }
  tep_redirect(tep_href_link(FILENAME_STAFF_MANAGER));
  break;
   case "Update":
  if ((int)$_POST['staff_id']) {
    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
	  $language_id = $languages[$i]['id'];
	  $sql_data_array = array();
	  if (isset($_POST['visible']))
	    $sql_data_array['visible'] = tep_db_prepare_input($_POST['visible']);
	  if (isset($_POST['sort_order']))
	    $sql_data_array['sort_order'] = tep_db_prepare_input($_POST['sort_order']);
	  if (isset($_POST['stafparent_id']))
	    $sql_data_array['stafparent_id'] = tep_db_prepare_input($_POST['stafparent_id']);
	  if (isset($_POST['staff_title']))
	    $sql_data_array['staff_title'] = tep_db_prepare_input($_POST['staff_title'][$language_id]);
	  if (isset($_POST['staff_description']))
	    $sql_data_array['staff_description'] = tep_db_prepare_input($_POST['staff_description'][$language_id]);
	  if (count($sql_data_array) > 0) {
	    $sql_data_array['staff_group_id'] = tep_db_prepare_input($gID);
	    if (tep_db_perform(TABLE_STAFF, $sql_data_array, 'update', "staff_id = '" . (int)$_POST['staff_id'] . "' and language_id = '" . (int)$language_id . "'")) {
		  $messageStack->add_session('Updated Successfully', 'success');
	    }
	  }
    }
    tep_redirect(tep_href_link(FILENAME_STAFF_MANAGER));
  } else {
    $error = "80";
  }
  break;
 }
 require(DIR_WS_INCLUDES . 'template_top.php');
?>
<!-- body_text //-->
 <table border="0" width="100%">
   <tr><td align="right"><?php //echo $languages_id; ?></td></tr>
<?php
 switch($action) {
   case "Added":
  $data = tep_get_staff_list();
  $no = 1;
  if (sizeof($data) > 0) {
    while (list($key, $val)=each($data)) {
	  $no++;
    }
  }
  $title = ADD_QUEUE_STAFF . " #" . $no;
  echo tep_draw_form('', FILENAME_STAFF_MANAGER, 'staff_action=AddSure');
  echo tep_draw_hidden_field('gID', $gID);
  include('staff_form.php');
  break;
   case "Edit":
  if ($staff_id = $_REQUEST['staff_id']) {
    $edit = tep_get_staff_entry($staff_id);
    $data = tep_get_staff_list();
    $button = array("Update");
    $title = EDIT_ID_STAFF . " " . $staff_id;
    echo tep_draw_form('', FILENAME_STAFF_MANAGER, 'staff_action=Update');
    echo tep_draw_hidden_field('staff_id', $staff_id);
    echo tep_draw_hidden_field('gID', $gID);
    include('staff_form.php');
  } else {
    $error = "80";
  }
  break;
   case 'Visible':
  if ($_GET['visible'] == '0') {
    $vivod = DEACTIVATION_ID_STAFF;
    tep_db_query("update " . TABLE_STAFF . " set visible = '0' where staff_id = '" . (int)$_GET['staff_id'] . "'");
  } else {
    $vivod = ACTIVATION_ID_STAFF;
    tep_db_query("update " . TABLE_STAFF . " set visible = '1' where staff_id = '" . (int)$_GET['staff_id'] . "'");
  }
  $data = tep_get_staff_list();
  $title = $confirm . " " . $vivod . " " . $staff_id . " " . SUCCED_STAFF;
  include('staff_list.php');
  break;
   case "Delete":
  if ($staff_id = $_GET['staff_id']) {
    $delete = tep_get_staff_entry($staff_id);
    $data = tep_get_staff_list();
    $title = DELETE_CONFIRMATION_ID_STAFF . " " . $staff_id;
    echo '<tr class="pageHeading"><td>' . $title . '</td></tr>';
    echo '<tr class="dataTableHeadingRow"><td align="left" class="dataTableHeadingContent">' . ENTRY_TITLE . '</td></tr>';
    echo '<tr><td class="dataTableContent" bgcolor="#DEE4E8" style="line-height: 18px;">' . $delete['staff_title'] . '</td></tr>';
    echo '<tr><td></td></tr>';
    echo '<tr><td align="right">';
    echo tep_draw_form('', FILENAME_STAFF_MANAGER, "staff_action=DelSure&staff_id=" . $delete['staff_id']);
    echo tep_draw_hidden_field('staff_id', $staff_id);
    echo tep_draw_hidden_field('gID', $gID);
    echo tep_draw_button(IMAGE_DELETE, 'trash', null, 'primary');
    echo " " . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_STAFF_MANAGER, 'gID=' . $gID));
    echo "</form></td></tr>";
  } else {
    $error = "80";
  }
  break;
   case "DelSure":
  if ($staff_id = $_GET['staff_id']) {
    tep_db_query("delete from " . TABLE_STAFF . " where staff_id = '" . (int)$staff_id . "'");
    $data = tep_get_staff_list();
    $title = $confirm . " " . DELETED_ID_STAFF . " " . $staff_id . " " . SUCCED_STAFF;
    include('staff_list.php');
  } else {
    $error = "80";
  }
  break;
   default:
  $data = tep_get_staff_list();
  $title = MANAGER_STAFF . " <font size='-1'>/ " . $staf_group['staff_group_title'] . "</font>";
  include('staff_list.php');
  flush();
  tep_update_staff_languages();
 } // END SWITCH
 if ($error) {
   $content = error_message($error);
   echo $content;
   $data = tep_get_staff_list();
   $no = 1;
   if (sizeof($data) > 0) {
  while (list($key, $val)=each($data)) {
    $no++;
  }
   }
   $title = ADD_QUEUE_STAFF . " " . $no;
   echo tep_draw_form('', FILENAME_STAFF_MANAGER, 'staff_action=AddSure');
   echo tep_draw_hidden_field('gID', $gID);
   include('staff_form.php');
 }
?>
 </table>
<?php
 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Posted

@@ce7

 

 

What you are doing has nothing to do with osCommerce, you are custom coding. You should refer to www.w3schools.com for help with SQL databases.

 

 

HOWEVER, after reviewing the staff_manager.php file and confirming the code looks good, I can only ask.....did you define the database tables in the database_tables.php file ?

 

 

 

Chris

Posted

Hi Chris,

 

thank you for your reply.

 

I did not write the code, I just copy the code from oscommerce add on "information page unlimited",

i also modified the sql code to fit the modification. (I dont really know the code well)

 

--
-- Table structure for table `staff`
--
DROP TABLE IF EXISTS `staff`;
CREATE TABLE `staff` (
`staff_id` tinyint(3) unsigned NOT NULL auto_increment,
`staff_group_id` int(11) unsigned NOT NULL default '0',
`staff_title` varchar(255) NOT NULL default '',
`staff_description` text NOT NULL,
`stafparent_id` int(11) default NULL,
`sort_order` tinyint(3) unsigned NOT NULL default '0',
`visible` enum('1','0') NOT NULL default '1',
`language_id` int(11) NOT NULL default '0',
PRIMARY KEY (`staff_id`,`language_id`)
) TYPE=MyISAM;
--
-- Dumping data for table 'staff`
--
-- --------------------------------------------------------
--
-- Table structure for table `staff_group`
--
DROP TABLE IF EXISTS `staff_group`;
CREATE TABLE `staff_group` (
`staff_group_id` int(11) NOT NULL auto_increment,
`staff_group_title` varchar(64) NOT NULL default '',
`staff_group_description` varchar(255) NOT NULL default '',
`sort_order` int(5) default NULL,
`visible` int(1) default '1',
`locked` varchar(255) NOT NULL default '',
PRIMARY KEY (`staff_group_id`)
) TYPE=MyISAM ;
--
-- Dumping data for table `staff_group`
--
INSERT INTO `staff_group` (`staff_group_id`, `staff_group_title`, `staff_group_description`, `sort_order`, `visible`, `locked`) VALUES (1, 'Staff pages', 'Staff pages', 1, 1, '');


 

the error message said that select from "information", I think it trying to access Table_INFORMATION, which I don't know which part of the code cause the problem. Im not sure if this is ok to ask in the information page unlimited, so I create a new page to ask this error.

 

thanks

 

Lyn

Posted

Hi Chris and George,

 

Yes, I had changed the database_table as well. However I double check again and I found that I did not save the database_table.php properly so only half of them were saved as staff, and the rest still remain "information". After redo again the database_table.php and the error message has gone.

 

However the page doesn't show up in the front page even though it did save in the database and also it show up in the backend admin page.

 

I mean in the front page, I have an inforbox show up as Staff Detail, and I create a staff name, it show up, but when you click on the staff name link,

(http://eg.com/staff.php?staf_id=1), it has nothing show up, just blank (suppose to have some text about staff introduction) and onlya CONTINUE button there, when you click on it, it just go to the index.php page.

 

which file I should check to fix this new problem now?

many thanks in advance.

 

Lyn

====================================================

 

The entire addon files include:

admin/staff_form.php

admin/staff_list.php

admin/staff_manager.php

admin/boxes/staff.php

admin/includes/languages/english/staff.php

 

catalog/staff.php

 

catalog/includes/function/staff.php

catalog/includes/languages/english/staff.php

includes/modules/boxes/bm_staff.php

 

 

 

 

Lyn

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...