Get mysql data and display it correctly

Discussion in 'PHP' started by snails07, Oct 21, 2010.

  1. #1
    I have the TPLancer component for Joomla installed on my site (http://gradfreelance.com) and I am trying to add some more information to the profile page of both the Freelancer and the Buyer.
    The information currently displayed on the profile pages is just data pulled from the database. I have added a new ‘website’ row in the database and have entered some data into the database but I can’t seem to get it to display.
    I thought it would just be something like echo $row->website; because echo $row->categories; works and so does echo $row->company; and they are all in the same table.
    There is something happening that is obviously way above my head. Below I have pasted a section of the code from the tplancer.php file which contains the function for what I am trying to target.


    function showLancerInfo($option) { global $mainframe; $user =& JFactory::getUser(); $db =& JFactory::getDBO(); $lancer_id = JRequest::getVar('id', 0, 'get', 'int');

    $is_lancer = isLancer($user->id);
    $is_buyer = isBuyer($user->id);
    $query = "select id FROM #__glance_lancer where userid =".$lancer_id;
    $db->setQuery( $query );
    $id = $db->loadResult();
    if(!$id)
    {
    echo "Freelancer not found!";
    return;
    }
    $query = "select username FROM #__users where id =".$lancer_id;
    $db->setQuery( $query );
    $username = $db->loadResult();
    $row =& JTable::getInstance('lancer','Table');
    $row->load($id);
    $query = "select * FROM #__glance_projects where chosen =".$lancer_id." ORDER BY id desc LIMIT 10";
    $db->setQuery( $query );
    $projects = $db->loadObjectList();
    $query = "select * FROM #__glance_bids where userid=".$lancer_id." order by id desc LIMIT 10 ";
    $db->setQuery( $query );
    $bids = $db->loadObjectList();

    HTML_front_glance::showLancerInfo($option,$row,$projects,$bids,$username);



    Below is some code from the tplancer.html.php file which displays the actual HTML on the page where I thought I would be adding $row->website; (highlighted red) but it is not displaying. I hope someone can help out! Cheers


    function showLancerInfo($option,$row,$projects,$bids,$username) { global $mainframe, $option; $user =& JFactory::getUser();

    $lancer_info = getUserInfo($row->userid);
    ?>

    <!-- /////////////////////// FREELANCER PROFILE PAGE /////////////////////// -->

    <?php
    $img = JPATH_SITE.DS.'images'.DS.'glance'.DS.$row->userid.'.jpg';
    if(file_exists($img)) {
    $img = JURI::base().'images/glance/'.$row->userid.'.jpg';
    echo '<img class="profile_logo" src="'.$img.'" alt="Logo" />';
    }
    else
    {
    $img = JURI::base().'components/com_glance/images/noimage.jpg';
    echo '<img class="profile_logo" src="'.$img.'" alt="Logo"/>';
    }
    ?>

    <div class="profile_info">
    <h1><?php echo $lancer_info['username'] ?><?php if($row->special=='y') {?>
    <img src="components/com_glance/images/featured.png" alt="Featured" class="feat_lancer" />
    <?php } ?></h1>
    <h3><?php echo $row->company ;?></h3>
    <p><?php echo $row->categories ; ?></p>
    <p>Website: <?php echo $row->website; ?></p>
    <p>Hourly Rate US $<?php echo $row->rate; ?></p>
     
    snails07, Oct 21, 2010 IP
  2. vtreanor

    vtreanor Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Still have problems with this?
    I would need much more information and the complete model/view/controller structure as well as the table structures involved

    Regards,

    vtreanor
     
    vtreanor, Oct 25, 2010 IP