1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Website noob needs assistance with PHP

Discussion in 'Web Design & Development' started by vipersf, Oct 6, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. vipersf

    vipersf Thread Starter

    Joined:
    Jul 27, 2006
    Messages:
    180
    Hello everyone,

    I have a website (passed on to me by someone) which has a roster in it. Link: http://www.beluxvacc.org/index.php?option=com_wrapper&Itemid=64

    As you can see it contains some names of our virtual air traffic controllers and many other things.

    BUT (why oh why always is there a "BUT" ;))

    I would like to add a column called "ELLX (Regional)", just like EBBR.
    From admin point of view it looks like this ... (see attachment).
    Basically , as you can see with EBBR, there should be an option "none, TWR and APP" also for ELLX. And the option should be shown in the roster on the website.

    At the moment there is a module on our website with following code:
    Code:
    <?php
    //Related Content//
    /**
    * Related Content Module
    * @package Mambo
    * @Copyright (C) 2000 - 2003 Miro International Pty Ltd
    * @ All rights reserved
    * @ Mambo is Free Software
    * @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
    * @version $Revision: 1.3 $
    **/
     
    defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
    ?>
    <p><font size="4" color="#004080"><br>
      <img src="../images/plane.jpg" width="20" height="15"> Belux vACC Controller 
      Roster</font></p>
    <p class="text">Belux vACC Controllers who where active the last six months.
    <br>(This list is updated manually)<br>
    <b>TESTING</b>
    <?
     
    $option = trim( mosGetParam( $_REQUEST, 'option', null ) );
    $task = trim( mosGetParam( $_REQUEST, 'task', null ) );
    $id = intval( mosGetParam( $_REQUEST, 'id', null ) );
     
    //if ($option == 'content' && $task == 'view' && $id) {
     
     $table_name = "members_belux";
     $where = " WHERE active = '1' ";
     // select the meta keywords from the item
     //$query = "SELECT metakey FROM mos_content WHERE id='$id'";
     $query = "SELECT fname, sname, vatsimid, rat_num, rating, info, staff, visiting, 
      active FROM $table_name".$where."ORDER BY fname ASC, sname ASC";
     
     $database->setQuery( $query );
     
     if ($data = trim( $database->loadResult() )) {
     print_r($data) ."<br>";
    ?>
    	 <table class="datatable" >
      		<tr>
        		<th ><b>Name</b></th>
        		<th align=center><b>Rating</b></th>
        		<th align=center><b>Vatsim ID</b></th>
        		<th ><b>Remarks</b></th>
        		<th><b>Guest</b></th>
        		<th><b>Staff</b></th>
    		  </tr>
    <?
      foreach ( $data as $member )
      {
    ?>
    	<tr>
    	<td align=left><? echo "$member->fname $member->sname"; ?></td>
    	<td align=center><? echo $member->rating; ?></td>
    	<td align=center><a href="http://data.vatsim.net/stats/private/list3.html?id=<?php echo $member->vatsimid; ?>"  target="_blank"><?php echo $member->vatsimid; ?></a></td>
    	<td align=left><?php echo $member->info; ?></td>
    	<td align=center><?php if ($member->visiting == '1') { echo "X"; } ?></td>
    	<td align=center><?php if ($member->staff == '1') { echo "X" ;} ?></td>
    	</tr>
    	
    	<?php
    
    
      }
    
      //$date = $db->get_var("SELECT last_change FROM $table_name ORDER BY last_change DESC") ;
      //$date = substr($date, 8, 2)."-".substr($date, 5, 3).substr($date, 0, 4);
      
    	?>
    	</table> <?
     } else {
      echo "no data loaded";
     }
    //}
    ?>
    
    
    What do I have to change here in order to get this column ??
    As you probably read in my post ... I know absolutly nothing about PHP so please be as specific and clear as possible

    I hope you can help me out here

    Regards

    Vipersf
     

    Attached Files:

  2. vipersf

    vipersf Thread Starter

    Joined:
    Jul 27, 2006
    Messages:
    180
  3. Techmonkeys

    Techmonkeys

    Joined:
    Feb 10, 2005
    Messages:
    625
    Hi Viper,

    How are you updating the list at the moment? say if you want to change one of the EBBR values from APP to TWR?

    Do you manually change the html ? or is it in a form somewhere?

    Basically, you need to store the info to go in the ELLX column in a database the call it using that module.

    However I dont see in the module where the EBBR values come from ?
     
  4. vipersf

    vipersf Thread Starter

    Joined:
    Jul 27, 2006
    Messages:
    180
    McCabe,

    - As you can see on the screen shot .. it's just a simply drop-down column on which you select the correct value.

    -Where these values come from I do not know (it's my presedor who gave me the website) .. is it possible that it's coming from a SqlDatabase ? Because I have seen that we have one of those ....

    Vipersf
     
  5. Techmonkeys

    Techmonkeys

    Joined:
    Feb 10, 2005
    Messages:
    625
    It will be an sql db, but even still to me it makes no sense as there is no column for EBBR listed in that code, but there is for the other columns

    Is this the code as it is at the moment on your site or is this just the module as it is downloaded?.

    Whoever did the site before may have modified this module slightly.

    would need to see the modified file I think.
     
  6. MMJ

    MMJ Guest

    Joined:
    Oct 15, 2006
    Messages:
    3,625
    I too had a look and couldn't see the EBBR column in the code.
     
  7. vipersf

    vipersf Thread Starter

    Joined:
    Jul 27, 2006
    Messages:
    180
    This is the code as it is at the moment on my site.
     
  8. Techmonkeys

    Techmonkeys

    Joined:
    Feb 10, 2005
    Messages:
    625
    Sorry Viper, not trying to be a pain for you, but the code above can't be as it is on the website.

    If you look at the code above you see this line:
    Code:
    <p class="text">Belux vACC Controllers who where active the last six months.
    <br>(This list is updated manually)<br>
    <b>TESTING</b>
    
    then look at the site and you can see the (This list is updated manually) bit, but then nowhere on the page does it say TESTING. So it can't be using that code.

    FTP to your website, then download this module directly.
     
  9. vipersf

    vipersf Thread Starter

    Joined:
    Jul 27, 2006
    Messages:
    180
    You'll probably kill me for this, but any advice on how to do this ??
     
  10. Techmonkeys

    Techmonkeys

    Joined:
    Feb 10, 2005
    Messages:
    625
    hehehehe :)

    I am guessing you do everything through front end at the moment, but do have any kind of access to upload and download files from the web site?#

    You will normally have an ftp address something like:
    ftp.beluxvacc.org
    then a username and password to access it?

    do you have these?

    (dont tell me them lol, just want to know if you have the details)
     
  11. vipersf

    vipersf Thread Starter

    Joined:
    Jul 27, 2006
    Messages:
    180
    I think I found it:

    Code:
     roster.php 
    HTML document text 
    --------------------------------------------------------------------------------
    
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style>
    all.clsMenuItemNS, .clsMenuItemIE{text-decoration: none; font: bold 12px Arial; color: white; cursor: hand; z-index:100}
    #MainTable A:hover {color: yellow;}
    </style>
    <link rel="stylesheet" href="css/belux.css" type="text/css">
    </head>
    <body bgcolor="#FFFFFF" text="#000000" class="text">
    <p><font size="4" color="#004080"><br>
      <img src="../images/plane.jpg" width="20" height="15"> Belux vACC Controller 
      Roster</font></p>
    <p class="text">Belux vACC Controllers who where active the last six months.
    <br>(This list is updated manually)<br>
    <?php 	
    require_once "../bincludes/ez_sql.php";
    $table_name = "members_belux";
    
    if (isset($_GET['active'])) {
      if ($_GET['active'] == '1') {
        $list = "active";
        $where = " WHERE active = '1' ";
        echo "<a href='".$_SERVER['PHP_SELF']."?active=0' target='_self'>Show unactive controllers</a><br><br>";
      } elseif ($_GET['active'] == '0') {
        $list = "active";
        $where = " WHERE active <> '1' ";  
        echo "<a href='".$_SERVER['PHP_SELF']."?active=1' target='_self'>Show active controllers</a><br><br>";
      }
    } else {
        $list = "active";
        $where = " WHERE active = '1' ";
        echo "<a href='".$_SERVER['PHP_SELF']."?active=0' target='_self'>Show unactive controllers</a><br><br>";
    }
    
    $sql = "SELECT fname, sname, vatsimid, rat_num, rating, ebbr, info, staff, visiting, 
      active FROM $table_name".$where."ORDER BY fname ASC, sname ASC";
      
    if ($data = $db->get_results("$sql")) {
    ?>
    	 <table class="datatable" >
      		<tr>
        		<th ><b>Name</b></th>
        		<th align=center><b>Rating</b></th>
        		<th align=center><b>EBBR</b></th>
        		<th align=center><b>Vatsim ID</b></th>
        		<th ><b>Remarks</b></th>
        		<th><b>Guest</b></th>
        		<th><b>Staff</b></th>
    		  </tr>
    <?
      foreach ( $data as $member )
      {
    ?>
    	<tr>
    	<td align=left><? echo "$member->fname $member->sname"; ?></td>
    	<td align=center><? echo $member->rating; ?></td>
    	<td align=left><?php echo $member->ebbr; ?></td>
    	<td align=center><a href="http://data.vatsim.net/stats/private/list3.html?id=<?php echo $member->vatsimid; ?>"  target="_blank"><?php echo $member->vatsimid; ?></a></td>
    	<td align=left><?php echo $member->info; ?></td>
    	<td align=center><?php if ($member->visiting == '1') { echo "X"; } ?></td>
    	<td align=center><?php if ($member->staff == '1') { echo "X" ;} ?></td>
    	</tr>
    	
    	<?php
    
    
      }
    
      $date = $db->get_var("SELECT last_change FROM $table_name ORDER BY last_change DESC") ;
      $date = substr($date, 8, 2)."-".substr($date, 5, 3).substr($date, 0, 4);
      
    	?>
    	</table> <?
    
    } else {
    
    	echo "Sorry, no records were found!";	
    
    }
    ?>
    
    <hr>
    <span class="updated">Last update: 
    <!-- #BeginDate format:Am1 -->
    <?php echo empty($date) ? "August 22, 2007" : $date; ?><!-- #EndDate -->
    </span> 
    </body>
    </html>
    
    
    Could this be the possible thing you were looking for ?
     
  12. Techmonkeys

    Techmonkeys

    Joined:
    Feb 10, 2005
    Messages:
    625
    Thats exactly it :)

    I have sent you a PM, let me know how you want to proceed
     
  13. vipersf

    vipersf Thread Starter

    Joined:
    Jul 27, 2006
    Messages:
    180
    Well it's not that I don't trust you, but I would really like to learn so that I do not have to contact you again when I have the same problem when adding a new column in a couple of weeks weeks/years ...

    So I don't know ... what would be best for you
     
  14. Techmonkeys

    Techmonkeys

    Joined:
    Feb 10, 2005
    Messages:
    625
    ok I will write up some instructions, but bere with me this will not be straight forward lol
     
  15. Techmonkeys

    Techmonkeys

    Joined:
    Feb 10, 2005
    Messages:
    625
    ok no probs however there is one more file we need to see before I can tell you exactly what you need to do.

    Tha page in the screenshot is an admin page whereby you can edit that table on your website and it's values.

    I need to see the code behind that page too.
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/756679

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice