Jump to content

require help with php and table combo.


Go to solution Solved by Ch0cu3r,

Recommended Posts

Hi everyone, 

i recently purchased the jbjobs component for joomla and have been modifying the views to suit my needs.

i've reached a dead end though. i have a php bit that needs to be combined with a table, but i have not managed to make it work. 

can someone please lend a hand?

thanks 

<?php
   $db=JFactory::getDBO();
   $q = "select * from #__jbjobs_employer where user_id=".$job->employer_id;
   $db->setQuery($q);
   $employer_record = $db->loadObject();                                   
            '<table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
               <td>';echo ($employer_record->show_addr == 'y')? "".$employer_record->street_addr : JText::_('JBJOBS_NOT_DISPLAYED').'</tr>
              <tr>
                <td>';
   echo ($employer_record->show_location == 'y')? "".$employer_record->city.', '.$employer_record->state : JText::_('JBJOBS_NOT_DISPLAYED').'</td>
               </tr>
              <tr>
                <td>';
   echo ($employer_record->show_phone == 'y')? "".$employer_record->primary_phone : JText::_('JBJOBS_NOT_DISPLAYED').'</td>
               </tr>
              <tr>
                <td>';  
   echo ($employer_record->show_fax == 'y')? "".$employer_record->fax_number : JText::_('JBJOBS_NOT_DISPLAYED').'</td>
               </tr>
              <tr>
                <td>';  
   $u = JFactory::getUser($job->employer_id);
   echo ($employer_record->show_email == 'y')? "".$u->email : JText::_('JBJOBS_NOT_DISPLAYED');'</td>
           </td>
               </tr>
           </table>'
?>
Link to comment
https://forums.phpfreaks.com/topic/286402-require-help-with-php-and-table-combo/
Share on other sites

  • Solution

Change your code to

$db=JFactory::getDBO();
$q = "select * from #__jbjobs_employer where user_id=".$job->employer_id;
$db->setQuery($q);
$employer_record = $db->loadObject();  

$u = JFactory::getUser($job->employer_id);
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>'.($employer_record->show_addr == 'y') ? $employer_record->street_addr : JText::_('JBJOBS_NOT_DISPLAYED')).'</tr>
  <tr>
    <td>'.(($employer_record->show_location == 'y')? $employer_record->city.', '.$employer_record->state : JText::_('JBJOBS_NOT_DISPLAYED')).'</td>
  </tr>
  <tr>
    <td>'.(($employer_record->show_phone == 'y')? $employer_record->primary_phone : JText::_('JBJOBS_NOT_DISPLAYED')).'</td>
  </tr>
  <tr>
    <td>'.(($employer_record->show_fax == 'y')? $employer_record->fax_number : JText::_('JBJOBS_NOT_DISPLAYED')).'</td>
  </tr>
  <tr>
    <td>'.(($employer_record->show_email == 'y')? $u->email : JText::_('JBJOBS_NOT_DISPLAYED')).'</td>
   </tr>
</table>';
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.