PHP syntax

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   PHP syntax
Donovan
CZ Active Member
 Codezwiz Site Donator
Donovan has been a member for over 20 year's 20 Year Member
usa.gif ohio.gif
Occupation: Web Developer
Gender: Male
Fav. Sports Team: St Louis Cardinals
Status: Offline
Joined: Dec 03, 2003
0.02 posts per day
Posts: 160
Points: 9,216
   
I am getting some of these errors when coding a page I am working on

Parse error: parse error, unexpected '/' in xxxx

Do I need the \ after $info[uniform] or is that a syntax error?

Where could I find the unexpected '/'


<tr>"
  . "         <td align=\"center\" bgcolor=\"#777777\" valign=\"top\">"
  . "            <img border=\"0\" src=\"modules/roster/images/$info[uniform]\">"
  . "         </td>"
  . "      </tr>



Here is the general area where these errors are occuring, Line 73 down to 92 in my code.


<tr>"
  . "                  <td width=\"12%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Status:&nbsp; </font></b>"
  . "                  </td>"
  . "                  <td width=\"4%\">"
  . "                     <p class=\"content\"><font color=\"#00FF00\">$info[c_status]</font>"
  . "                  </td>"
  . "                  <td width=\"18%\">"
  . "                     <p align=\"right\"><font color=\"#660033\"><b>Primary MOS:</b></font>"
  . "                  </td>"
  . "                  <td width=\"7%\">"
  . "                     <p class=\"content\">$info[p_mos]
  . "                  </td>"
  . "                  <td width=\"18%\">"
  . "                     <p align=\"right\"><font color=\"#660033\"><b>Secondary MOS:</b></font>"
  . "                  </td>"
  . "                  <td width=\"7%\">"
  . "                     <p class=\"content\">$info[s_mos]
  . "                  </td>"
  . "               </tr>"



Back to top Reply with quote
#2   re: PHP syntax
Kelly_Hero
PayPal Donation
CZ Revered Member
 Codezwiz Site Donator
usa.gif southcarolina.gif
Occupation: Web Developer
Age: 59
Gender: Female
Website:
Status: Offline
Joined: Aug 20, 2003
0.49 posts per day
Posts: 3765
Points: 351,412
   
Hi Steve,

Just going by the code that you posted above, the answer is yes, you need the \ after $info[uniform]. It escapes the " immediately after it.

Looking through the rest of the code you posted, I see some lines where you didn't put the closing ", right after $info[p_mos] and right after $info[s_mos]. You also have an extra > right after the last </tr>".

If fixing those doesn't get rid of the error, post the whole error, along with the full code.



Back to top Reply with quote
#3   re: PHP syntax
Donovan
CZ Active Member
 Codezwiz Site Donator
Donovan has been a member for over 20 year's 20 Year Member
usa.gif ohio.gif
Occupation: Web Developer
Gender: Male
Fav. Sports Team: St Louis Cardinals
Status: Offline
Joined: Dec 03, 2003
0.02 posts per day
Posts: 160
Points: 9,216
   
Thanks for the help Kelly.
icon_biggrin.gif

Parse error: parse error, unexpected '/' in /home/i3rd-inf/public_html/modules/roster/rosterprofile.php on line 85

This was a straight html page I made to try and improve the profile page in Clan Nuke. I used a html to php converter and have been hacking it up ever since.




<?php
//////////////////////////////////////////////////////////////////////
//===========================
// MILPACS
//
// This is the Military Personell and Classification System.
// This hack is from the roster mod of Clan Nuke
//
//
///////////////////////////////////////////////////////////////////////

if (!eregi("modules.php", $PHP_SELF)) {
   die ("You can't access this file directly...");
    }

$index=1;
require_once("mainfile.php");
//finds the server's root directory
$self = dirname(__FILE__);
$nukemod = basename($self);
$rootdir = eregi_replace("/modules/$nukemod", "", $self);

include "$rootdir/admin/modules/clannuke/functions.php";
global $module_name, $db;
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
include("header.php");
OpenTable();
$clanmod = "roster";
$result = $db->sql_query("SELECT * FROM roster_profile WHERE uniqueid ='$handlename'");
$info = $db->sql_fetchrow($result);
    if (!$result) {
    echo("<p>Error performing query: " . mysql_error() . "</p>");
    exit();
    }

echo"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"
  . "<html>"
  . "<head>"
  . "<title>Untitled Document</title>"
  . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"
  . "</head>"
  . ""
  . "<body>"
  . "<table border=\"2\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-collapse: collapse\" bgcolor=\"#000000\" bordercolor=\"#111111\" width=\"655\">      <tr>"
  . "         <td align=\"center\" bgcolor=\"#777777\">"
  . "            <b><font color=\"#000000\">Profile of $info[u_rank] $info[u_handle]\</font></b>"
  . "         </td>"
  . "      </tr>      <tr>"
  . "         <td align=\"center\" bgcolor=\"#777777\" valign=\"top\">"
  . "            <img border=\"0\" src=\"modules/roster/images/$info[uniform]\">"
  . "         </td>"
  . "      </tr>      <tr>"
  . "         <td align=\"left\" bgcolor=\"#666633\">"
  . "            <b><font color=\"#000000\">Vital Statistics</font></b>"
  . "         </td>"
  . "      </tr>      <tr>"
  . "         <td align=\"left\" bgcolor=\"#999999\">"
  . "            <table border=\"1\" cellpadding=\"2\" cellspacing=\"1\" "
  . "               style=\"border-collapse: collapse\" width=\"100%\" "
  . "               id=\"AutoNumber1\" bordercolor=\"#111111\">"
  . "               <tr>"
  . "                  <td width=\"8%\" rowspan=\"9\" align=\"center\">"
  . "                     <img border=\"0\" src=\"modules/roster/images/$info[u_rank]\"><br>TSGT<br><br>"
  . "                     <img border=\"0\" src=\"modules/roster/images/flags/$info[flag]\">"
  . "                  </td>"
  . "                  <td width=\"12%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Location:</font></b>"
  . "                  </td>"
  . "                  <td width=\"80%\" colspan=\"5\">"
  . "                     <p class=\"content\">$info[Location]\</td>"
  . "               </tr>"
  . "               <tr>"
  . "                  <td width=\"12%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Status:&nbsp; </font></b>"
  . "                  </td>"
  . "                  <td width=\"4%\">"
  . "                     <p class=\"content\"><font color=\"#00FF00\">$info[c_status]\</font>"
  . "                  </td>"
  . "                  <td width=\"18%\">"
  . "                     <p align=\"right\"><font color=\"#660033\"><b>Primary MOS:</b></font>"
  . "                  </td>"
  . "                  <td width=\"7%\">"
  . "                     <p class=\"content\">$info[p_mos]\"
  . "                  </td>"
  . "                  <td width=\"18%\">"
  . "                     <p align=\"right\"><font color=\"#660033\"><b>Secondary MOS:</b></font>"
  . "                  </td>"
  . "                  <td width=\"7%\">"
  . "                     <p class=\"content\">$info[s_mos]\"
  . "                  </td>"
  . "               </tr>"
  . "
  . "               
  . "               <tr>"
  . "                  <td width=\"15%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Combat Unit:</font></b>"
  . "                  </td>"
  . "                  <td width=\"44%\" colspan=\"3\">"
  . "                     <p class=\"content\"><a href=\"modules.php?name=MILPACS&mode=displayunit&id=11\" title=\"\">$info[c_unit]\</a>"
  . "                  </td>"
  . "                  <td width=\"13%\">"
  . "                     <p align=\"right\"><font color=\"#660033\"><b>Reports to:</b></font>"
  . "                  </td>"
  . "                  <td width=\"30%\">"
  . "                     <a href=\"modules.php?name=MILPACS&mode=displayprofile&id=1251\" title=\"\">$info[c_reports]\</a>"
  . "                  </td>"
  . "               </tr>"
  . "               <tr>"
  . "                  <td width=\"17%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Combat Position:</font></b>"
  . "                  </td>"
  . "                  <td width=\"80%\" colspan=\"5\">"
  . "                     <p class=\"content\">$info[c_position]\"
  . "                  </td>"
  . "               </tr>   "
  . "               <tr>"
  . "                  <td width=\"17%\" align=\"right\">"
  . "                     <font color=\"#660033\"><b>Duty Unit:</b></font>"
  . "                  </td>"
  . "                  <td width=\"44%\" colspan=\"3\">"
  . "                     <p class=\"content\"><a href=\"modules.php?name=MILPACS&mode=displayunit&id=72\" title=\"\">$info[d_unit]\</a>"
  . "                  </td>"
  . "                  <td width=\"13%\">"
  . "                     <p align=\"right\"><font color=\"#660033\"><b>Reports to:</b></font>"
  . "                  </td>"
  . "                  <td width=\"30%\">"
  . "                     <a href=\"modules.php?name=MILPACS&mode=displayprofile&id=260\" title=\"\">$info[d_reports]\</a>"
  . "                  </td>"
  . "               </tr>"
  . "                  "
  . "               </tr>"
  . "               <tr>"
  . "                  <td width=\"12%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Duty Position:</font></b>"
  . "                  </td>"
  . "                  <td width=\"80%\" colspan=\"5\">"
  . "                     <p class=\"content\">$info[d_position]\"
  . "                  </td>"
  . "               </tr>"
  . "               <tr>"
  . "                  <td width=\"12%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Enlisted:&nbsp; </font></b>"
  . "                  </td>"
  . "                  <td width=\"15%\">"
  . "                     <p class=\"content\">$info[enlisted_dt]\"
  . "                  </td>"
  . "                  <td width=\"10%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Inducted:</font></b>"
  . "                  </td>"
  . "                  <td width=\"66%\" colspan=\"3\">"
  . "                     <p class=\"content\">$info[inducted_dt]\"
  . "                  </td>"
  . "               </tr>"
  . "               <tr>"
  . "                  <td width=\"12%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">ICQ#:&nbsp; </font></b>"
  . "                  </td>"
  . "                  <td width=\"15%\">"
  . "                     <p class=\"content\">$info[icq]\"
  . "                  </td>"
  . "                  <td width=\"10%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">E-mail:</font></b>"
  . "                  </td>"
  . "                  <td width=\"66%\" colspan=\"3\">"
  . "                     <p class=\"content\"><a href=\"$info[email]\"</a>"
  . "                  </td>"
  . "               </tr>"
  . "            </table>"
  . "         </td>"
  . "      </tr>      <tr>"
  . "         <td align=\"left\" bgcolor=\"#666633\">"
  . "            <b><font color=\"#000000\">Personal Bio</font></b>"
  . "         </td>"
  . "      </tr>      <tr>"
  . "         <td align=\"left\" bgcolor=\"#999999\">"
  . "            <p class=\"content\">$info[bio]\"
  . "
  . "         </td>"
  . "      </tr>"
  . "      <tr>"
  . "         <td align=\"left\" bgcolor=\"#666633\">"
  . "            <b><font color=\"#000000\">Service Record</font></b>"
  . "         </td>"
  . "      </tr>   "
  . "      <tr>"
  . "         <td align=\"left\" bgcolor=\"#999999\">"
  . "            <table border=\"1\" cellpadding=\"2\" cellspacing=\"1\" style=\"border-collapse: collapse\" "
  . "               width=\"100%\" id=\"AutoNumber2\" bordercolor=\"#111111\">"
  . "                              <tr>"
  . "                  <td>"
  . "                     <p class=\"content\">$info[record]\</p>"
  . "                  </td>"
  . "               </tr>"
  . "            </table>"
  . "         </td>"
  . "      </tr>      <tr>"
  . "         <td align=\"left\" bgcolor=\"#666633\">"
  . "            <b><font color=\"#000000\">Awards & Recognition</font></b>"
  . "         </td>"
  . "               "
  . "      </tr>"
  . ""
  . "      <tr>"
  . "         <td align=\"left\" bgcolor=\"#999999\">"
  . "            <table border=\"1\" cellpadding=\"2\" cellspacing=\"1\" style=\"border-collapse: collapse\" "
  . "               width=\"100%\" id=\"AutoNumber2\" bordercolor=\"#111111\">"
  . "                              <tr>"
  . "                  <td width=\"11%\" valign=\"top\" align=\"left\">"
  . "                     13JUN2004"
  . "                  </td>"
  . "                  <td width=\"89%\" valign=\"top\" align=\"left\">"
  . "                     NCO Development Ribbon for Passed NCO Training Course &nbsp;(<a  href=\"modules.php?name=MILPACS&mode=viewaward&aid=327\">details</a>)"
  . "                  </td>"
  . "               </tr>               <tr>"
  . "                  <td width=\"11%\" valign=\"top\" align=\"left\">"
  . "                     20JULY2003"
  . "                  </td>"
  . "                  <td width=\"89%\" valign=\"top\" align=\"left\">"
  . "                     3rd Infantry Division Extended Service Medal [3IDESM] - Awarded after one full year of service in the 3rd Infantry Division &nbsp;(<a  href=\"modules.php?name=MILPACS&mode=viewqualification&qid=398\">details</a>)"
  . "                  </td>"
  . "               </tr>               <tr>"
  . "                  <td width=\"11%\" valign=\"top\" align=\"left\">"
  . "                     29APR2003"
  . "                  </td>"
  . "                  <td width=\"89%\" valign=\"top\" align=\"left\">"
  . "                     Army Commendation Medal for contributing much more to the division than is asked.  &nbsp;(<a  href=\"modules.php?name=MILPACS&mode=viewaward&aid=296\">details</a>)"
  . "                  </td>"
  . "               </tr>               <tr>"
  . "                  <td width=\"11%\" valign=\"top\" align=\"left\">"
  . "                     06AUG2002"
  . "                  </td>"
  . "                  <td width=\"89%\" valign=\"top\" align=\"left\">"
  . "                     World War 2 Victory Medal for competing in a match &nbsp;(<a  href=\"modules.php?name=MILPACS&mode=viewqualification&qid=310\">details</a>)"
  . "                  </td>"
  . "               </tr>               <tr>"
  . "                  <td width=\"11%\" valign=\"top\" align=\"left\">"
  . "                     22JULY2002"
  . "                  </td>"
  . "                  <td width=\"89%\" valign=\"top\" align=\"left\">"
  . "                     America Defense Service Ribbon for Graduation from Recruit Training &nbsp;(<a  href=\"modules.php?name=MILPACS&mode=viewaward&aid=251\">details</a>)"
  . "                  </td>"
  . "               </tr>"
  . "            </table>"
  . "         </td>"
  . "      </tr>"
  . "</table>"
  . ""
  . "</body>"
  . "</html>"
  ."";



Back to top Reply with quote
#4   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.04 posts per day
Posts: 8089
Points: 494,430
   
. "                     <p class=\"content\">$info[p_mos]\"


You have that twice or similar to it should be

. "                     <p class=\"content\">$info[p_mos]"




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#5   re: PHP syntax
Kelly_Hero
PayPal Donation
CZ Revered Member
 Codezwiz Site Donator
usa.gif southcarolina.gif
Occupation: Web Developer
Age: 59
Gender: Female
Website:
Status: Offline
Joined: Aug 20, 2003
0.49 posts per day
Posts: 3765
Points: 351,412
   
Same thing Telli said, but in these lines also:
<p class=\"content\">$info[s_mos]\"
<p class=\"content\">$info[c_position]\"
<p class=\"content\">$info[d_position]\"
<p class=\"content\">$info[enlisted_dt]\"
<p class=\"content\">$info[inducted_dt]\"
<p class=\"content\">$info[icq]\"


Where you got mixed up is you only need to escape quotation marks when they're inside of quotation marks. For example, in the lines above class="content" sits inside the echo " ", so you'd need to escape those, but you wouldn't escape the outer quotation marks.

Make sense??


Back to top Reply with quote
#6   re: PHP syntax
Donovan
CZ Active Member
 Codezwiz Site Donator
Donovan has been a member for over 20 year's 20 Year Member
usa.gif ohio.gif
Occupation: Web Developer
Gender: Male
Fav. Sports Team: St Louis Cardinals
Status: Offline
Joined: Dec 03, 2003
0.02 posts per day
Posts: 160
Points: 9,216
   
Yes it does. My next question is the query to select records.

$result = $db->sql_query("SELECT * FROM roster_profile a JOIN roster_members b JOIN roster_ranks WHERE a.uniqueid = b.uniqueid");

before I had uniqueid = '$handlename' but I coudn't find why the original author was using a variable $handlename, so I joined on uniqueid which exist in both my tables.

I have the uniqueid in each table, but even though I select a member with uniqueid=14 it still comes back with the data for uniqueid =1 for any member I choose.

You can check it out here:
[ Register or login to view links on this board. ]

Any help on this will be greatly appreciated.

The project is coming along... icon_biggrin.gif



Back to top Reply with quote
#7   re: PHP syntax
Donovan
CZ Active Member
 Codezwiz Site Donator
Donovan has been a member for over 20 year's 20 Year Member
usa.gif ohio.gif
Occupation: Web Developer
Gender: Male
Fav. Sports Team: St Louis Cardinals
Status: Offline
Joined: Dec 03, 2003
0.02 posts per day
Posts: 160
Points: 9,216
   
Well I went thru my new tables and identified where uniqueid would not be used so I changed them to something more decriptive.

In roster_members I have

u_handle
u_rank
uniqueid
etc..

In roster_profile I have

u_handle
rank_id
u_email
uniqueid <--primary
location
award_id
etc...


In roster_ranks I have

rankname
rank_id <--primary
rank_image
rank_image_l
rank_abbr


So now I am trying to understand why I can't get the proper rank image or rankname to show up under each members profile when I view the rosterprofile page:

Here is my rosterprofile page:

<?php
//////////////////////////////////////////////////////////////////////
//===========================
// MILPACS
//
// This is the Military Personell and Classification System.
//
//
//
///////////////////////////////////////////////////////////////////////

if (!eregi("modules.php", $PHP_SELF)) {
   die ("You can't access this file directly...");
    }

$index=1;
require_once("mainfile.php");
//finds the server's root directory
$self = dirname(__FILE__);
$nukemod = basename($self);
$rootdir = eregi_replace("/modules/$nukemod", "", $self);

include "$rootdir/admin/modules/clannuke/functions.php";
global $module_name, $db;
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
include("header.php");
OpenTable();
$clanmod = "roster";
$result = $db->sql_query("SELECT * FROM roster_profile WHERE uniqueid ='$handlename'");
$info = $db->sql_fetchrow($result);
    if (!$result) {
    echo("<p>Error performing query: " . mysql_error() . "</p>");
    exit();
    }

$result1 = $db->sql_query("SELECT * FROM roster_ranks a JOIN roster_profile b WHERE a.rank_id = b.rank_id");
$info1 = $db->sql_fetchrow($result1);
    if (!$result) {
    echo("<p>Error performing query: " . mysql_error() . "</p>");
    exit();
    }

$result2 = $db->sql_query("SELECT * FROM roster_award a JOIN roster_profile b WHERE a.award_id = b.award_id");
$info2 = $db->sql_fetchrow($result2);
    if (!$result) {
    echo("<p>Error performing query: " . mysql_error() . "</p>");
    exit();
    }

$result3 = $db->sql_query("SELECT * FROM roster_awards a JOIN roster_profile b WHERE a.award_id = b.award_id");
   while ( $row = $db->sql_fetchrow($result3) ) {
      $awardname = $row["award_name"];
      $awarddetail = $row["award_decription"];
        if (!$result3) {
          echo("<p>Error performing query: " . mysql_error() . "</p>");
          exit();
        }
   }

echo"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"
  . "<html>"
  . "<head>"
  . "<title>Untitled Document</title>"
  . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"
  . "</head>"
  . ""
  . "<body>"
  . "<table border=\"2\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-collapse: collapse\" bgcolor=\"#000000\" bordercolor=\"#111111\" width=\"655\">      <tr>"
  . "         <td align=\"center\" bgcolor=\"#777777\">"
  . "            <b><font color=\"#000000\">Profile of $info1[rank_abbr] $info[u_handle]</font></b>"
  . "         </td>"
  . "      </tr>      <tr>"
  . "         <td align=\"center\" bgcolor=\"#777777\" valign=\"top\">"
  . "            <img border=\"0\" src=\"modules/roster/images/uniform/$info[uniform]"
  . "         </td>"
  . "      </tr>      <tr>"
  . "         <td align=\"left\" bgcolor=\"#666633\">"
  . "            <b><font color=\"#000000\">Vital Statistics</font></b>"
  . "         </td>"
  . "      </tr>      <tr>"
  . "         <td align=\"left\" bgcolor=\"#999999\">"
  . "            <table border=\"1\" cellpadding=\"2\" cellspacing=\"1\" "
  . "               style=\"border-collapse: collapse\" width=\"100%\" "
  . "               id=\"AutoNumber1\" bordercolor=\"#111111\">"
  . "               <tr>"
  . "                  <td width=\"8%\" rowspan=\"9\" align=\"center\">"
  . "                     <img border=\"0\" src=\modules/roster/images/ranks/$info1[rank_image_l]"
  . "                     <br><br><br>"
  . "                     <img border=\"0\" src=\modules/roster/images/flags/$info[flag]"
  . "                  </td>"
  . "                  <td width=\"12%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Location:</font></b>"
  . "                  </td>"
  . "                  <td width=\"80%\" colspan=\"5\">"
  . "                     <p class=\"content\">$info[location]"
  . "                  </td>"
  . "               </tr>"
  . "               <tr>"
  . "                  <td width=\"12%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Status: ;; </font></b>"
  . "                  </td>"
  . "                  <td width=\"4%\">"
  . "                     <p class=\"content\"><font color=\"#00FF00\">$info[c_status]</font>"
  . "                  </td>"
  . "                  <td width=\"18%\">"
  . "                     <p align=\"right\"><font color=\"#660033\"><b>Primary MOS:</b></font>"
  . "                  </td>"
  . "                  <td width=\"7%\">"
  . "                     <p class=\"content\">$info[p_mos]"
  . "                  </td>"
  . "                  <td width=\"18%\">"
  . "                     <p align=\"right\"><font color=\"#660033\"><b>Secondary MOS:</b></font>"
  . "                  </td>"
  . "                  <td width=\"7%\">"
  . "                     <p class=\"content\">$info[s_mos]"
  . "                  </td>"
  . "               </tr>"
  . "
  . "               
  . "               <tr>"
  . "                  <td width=\"15%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Combat Unit:</font></b>"
  . "                  </td>"
  . "                  <td width=\"44%\" colspan=\"3\">"
  . "                     <p class=\"content\"><a href=\"modules.php?name=roster&file=unitprofile&unit_id=uniqueid\" title=\"\">$info[c_unit]</a>"
  . "                  </td>"
  . "                  <td width=\"13%\">"
  . "                     <p align=\"right\"><font color=\"#660033\"><b>Reports to:</b></font>"
  . "                  </td>"
  . "                  <td width=\"30%\">"
  . "                     <a href=\"modules.php?name=roster&file=rosterprofile&handlename=$uid\" title=\"\">$info[c_reports]</a>"
  . "                  </td>"
  . "               </tr>"
  . "               <tr>"
  . "                  <td width=\"17%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Combat Position:</font></b>"
  . "                  </td>"
  . "                  <td width=\"80%\" colspan=\"5\">"
  . "                     <p class=\"content\">$info[c_position]"
  . "                  </td>"
  . "               </tr>   "
  . "               <tr>"
  . "                  <td width=\"17%\" align=\"right\">"
  . "                     <font color=\"#660033\"><b>Duty Unit:</b></font>"
  . "                  </td>"
  . "                  <td width=\"44%\" colspan=\"3\">"
  . "                     <p class=\"content\"><a href=\"modules.php?name=roster&filee=displayunit&id=uniqueid\" title=\"\">$info[d_unit]</a>"
  . "                  </td>"
  . "                  <td width=\"13%\">"
  . "                     <p align=\"right\"><font color=\"#660033\"><b>Reports to:</b></font>"
  . "                  </td>"
  . "                  <td width=\"30%\">"
  . "                     <a href=\"modules.php?name=roster&file=displayprofile&id=uniqueid\" title=\"\">$info[d_reports]</a>"
  . "                  </td>"
  . "               </tr>"
  . "                  "
  . "               </tr>"
  . "               <tr>"
  . "                  <td width=\"12%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Duty Position:</font></b>"
  . "                  </td>"
  . "                  <td width=\"80%\" colspan=\"5\">"
  . "                     <p class=\"content\">$info[d_position]"
  . "                  </td>"
  . "               </tr>"
  . "               <tr>"
  . "                  <td width=\"12%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Enlisted: ;; </font></b>"
  . "                  </td>"
  . "                  <td width=\"15%\">"
  . "                     <p class=\"content\">$info[enlisted_dt]"
  . "                  </td>"
  . "                  <td width=\"10%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">Inducted:</font></b>"
  . "                  </td>"
  . "                  <td width=\"66%\" colspan=\"3\">"
  . "                     <p class=\"content\">$info[inducted_dt]"
  . "                  </td>"
  . "               </tr>"
  . "               <tr>"
  . "                  <td width=\"12%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">ICQ#: ;; </font></b>"
  . "                  </td>"
  . "                  <td width=\"15%\">"
  . "                     <p class=\"content\">$info[icq]"
  . "                  </td>"
  . "                  <td width=\"10%\" align=\"right\">"
  . "                     <b><font color=\"#660033\">E-mail:</font></b>"
  . "                  </td>"
  . "                  <td width=\"66%\" colspan=\"3\">"
  . "                     <p class=\"content\"><a href=\$info[email]</a>"
  . "                  </td>"
  . "               </tr>"
  . "            </table>"
  . "         </td>"
  . "      </tr>      <tr>"
  . "         <td align=\"left\" bgcolor=\"#666633\">"
  . "            <b><font color=\"#000000\">Personal Bio</font></b>"
  . "         </td>"
  . "      </tr>      <tr>"
  . "         <td align=\"left\" bgcolor=\"#999999\">"
  . "            <p class=\"content\">$info[bio]"
  . "         </td>"
  . "      </tr>"
  . "      <tr>"
  . "         <td align=\"left\" bgcolor=\"#666633\">"
  . "            <b><font color=\"#000000\">Service Record</font></b>"
  . "         </td>"
  . "      </tr>   "
  . "      <tr>"
  . "         <td align=\"left\" bgcolor=\"#999999\">"
  . "            <table border=\"1\" cellpadding=\"2\" cellspacing=\"1\" style=\"border-collapse: collapse\" "
  . "               width=\"100%\" id=\"AutoNumber2\" bordercolor=\"#111111\">"
  . "                              <tr>"
  . "                  <td>"
  . "                     <p class=\"content\">$info[record]</p>"
  . "                  </td>"
  . "               </tr>"
  . "            </table>"
  . "         </td>"
  . "      </tr>      <tr>"
  . "         <td align=\"left\" bgcolor=\"#666633\">"
  . "            <b><font color=\"#000000\">Awards & Recognition</font></b>"
  . "         </td>"
  . "      </tr>"
  . "      <tr>"
  . "         <td align=\"left\" bgcolor=\"#999999\">"
  . "            <table border=\"1\" cellpadding=\"2\" cellspacing=\"1\" style=\"border-collapse: collapse\" "
  . "               width=\"100%\" id=\"AutoNumber2\" bordercolor=\"#111111\">"
  . "                              <tr>"
  . "                  <td width=\"11%\" valign=\"top\" align=\"left\">"
  . "                     13JUN2004"
  . "                  </td>"
  . "                  <td width=\"89%\" valign=\"top\" align=\"left\">"
  . "                     $info2[award_name]  ; $info2[award_description];(<a  href=\"modules.php?name=MILPACS&mode=viewaward&aid=327\">details</a>)"
  . "                  </td>"
  . "               </tr>               <tr>"
  . "                  <td width=\"11%\" valign=\"top\" align=\"left\">"
  . "                     20JULY2003"
  . "                  </td>"
  . "                  <td width=\"89%\" valign=\"top\" align=\"left\">"
  . "                     3rd Infantry Division Extended Service Medal [3IDESM] - Awarded after one full year of service in the 3rd Infantry Division  ;;(<a  href=\"modules.php?name=MILPACS&mode=viewqualification&qid=398\">details</a>)"
  . "                  </td>"
  . "               </tr>               <tr>"
  . "                  <td width=\"11%\" valign=\"top\" align=\"left\">"
  . "                     29APR2003"
  . "                  </td>"
  . "                  <td width=\"89%\" valign=\"top\" align=\"left\">"
  . "                     Army Commendation Medal for contributing much more to the division than is asked.   ;;(<a  href=\"modules.php?name=MILPACS&mode=viewaward&aid=296\">details</a>)"
  . "                  </td>"
  . "               </tr>               <tr>"
  . "                  <td width=\"11%\" valign=\"top\" align=\"left\">"
  . "                     06AUG2002"
  . "                  </td>"
  . "                  <td width=\"89%\" valign=\"top\" align=\"left\">"
  . "                     World War 2 Victory Medal for competing in a match  ;;(<a  href=\"modules.php?name=MILPACS&mode=viewqualification&qid=310\">details</a>)"
  . "                  </td>"
  . "               </tr>               <tr>"
  . "                  <td width=\"11%\" valign=\"top\" align=\"left\">"
  . "                     22JULY2002"
  . "                  </td>"
  . "                  <td width=\"89%\" valign=\"top\" align=\"left\">"
  . "                     America Defense Service Ribbon for Graduation from Recruit Training  ;;(<a  href=\"modules.php?name=MILPACS&mode=viewaward&aid=251\">details</a>)"
  . "                  </td>"
  . "               </tr>"
  . "            </table>"
  . "         </td>"
  . "      </tr>"
  . "</table>"
  . ""
  . "</body>"
  . "</html>"
  ."";



And here is my index page that displays the roster.

<?php
//////////////////////////////////////////////////////////////////////
// MILPACS
//
// This is the Military Personell and Classification System.
///////////////////////////////////////////////////////////////////////

if (!eregi("modules.php", $PHP_SELF)) {
   die ("You can't access this file directly...");
    }
$index = 0;

//finds the server's root directory
$self = dirname(__FILE__);
$nukemod = basename($self);
$rootdir = eregi_replace("/modules/$nukemod", "", $self);

include "$rootdir/admin/modules/clannuke/functions.php";
$index=0;

require_once("mainfile.php");
global $module_name, $db;
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
include("header.php");
OpenTable();

$result = $db->sql_query("SELECT name FROM roster_main");
    if (!$result) {
    echo (_INSTERROR."<BR>");
    echo("<p>Error performing query: " . mysql_error() . "</p>");
    exit();
    }
while ( $row = $db->sql_fetchrow($result) ) {
    $rostername = $row["name"];
}
echo "<style type=\"text/css\">
<!--
/* Info */
.mainrosterbig      { font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; font-weight:bold; }
.mainroster      { font-size: 10.5px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; font-weight:bold; }
a.mainroster,a.mainroster:visited      { color: #FFFFFF; text-decoration: none;}
a.mainroster:hover { color:#FEFEFE; text-decoration: underline;}
-->
</style>";
echo "<table border=0><tr><td width=100%>";
echo ("<font class=\"mainroster\"><big><b>" . $rostername . "</b></big></font><hr width=200 align=\"left\">");
echo ("<br><font class=\"mainroster\">"._MEMLOGIN." [ <a class=\"mainroster\" href=\"modules.php?name=$module_name&file=login\">"._HERE."</a> ]</font></td><td width=60% align=\"right\" valign=\"top\">");
jumpto("roster", "recruit", $db);
echo "</td></tr></table>";
CloseTable();
echo "<br>";
OpenTable();

$result = $db->sql_query("SELECT type FROM roster_main");

while ( $row = $db->sql_fetchrow($result) ) {
   $displaytype = $row["type"];
}

//begin layout type if structure

if ($displaytype == 0) {

    $result = $db->sql_query("SELECT `rankname` FROM `roster_ranks` ORDER BY `uniqueid`");
   while ( $row = $db->sql_fetchrow($result) ) {
      $rankname = $row["rankname"];
        $flag=0;
      $result1 = $db->sql_query("SELECT `u_handle`, `uniqueid` FROM `roster_members` WHERE `u_rank`='$rankname'");
        if (!$result1) {
          echo("<p>Error performing query: " . mysql_error() . "</p>");
          exit();
        }

        $flag = $db->sql_numrows($result1);

      if ($flag == 1) {echo ("<b>" . $rankname . "</b> (1 member)<hr width=150 align='left'>");}
      else if ($flag > 1) {$ending = findEnding($rankname); echo ("<b>" . $rankname . $ending . "</b> ($flag members)<hr width=150 align='left'>");}
        else {echo ("<b>" . $rankname . "</b> ($flag members)<hr width=150 align='left'>");}

      $test = 0;
      while ( $row = $db->sql_fetchrow($result1) ) {
          $hname = $row["u_handle"];
          $uid = $row["uniqueid"];
          echo ("<a href=\"modules.php?name=$module_name&file=rosterprofile&handlename=$uid\">$hname</a><br>");
         $test = 1;
        }
      if ($test == 0)
         echo "<i>empty</i><br>";
        echo "<br>";
        }
   }

else if ($displaytype == 1) {
    $sql = "SELECT `rankname`, `rank_image` FROM `roster_ranks` ORDER BY `uniqueid`";
    $result1 = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result1)) {
     $rankname = $row['rankname'];
     $rank_image = $row['rank_image'];
   $result = $db->sql_query("SELECT tablenum, table_1, table_2, table_3, table_4 FROM roster_main");
   while ( $row = $db->sql_fetchrow($result) ) {
      $tablenum = $row["tablenum"];
       $table_1 = $row["table_1"];
       $table_2 = $row["table_2"];
       $table_3 = $row["table_3"];
       $table_4 = $row["table_4"];
   }

   $resulta = $db->sql_query("SELECT `rankname`, `rank_image` FROM `roster_ranks` WHERE `rankname`='$rankname'");

    //lists the header for the table displaying what's what
    echo "<table border=0 width='100%' cellpadding='5'><tr>";
    echo "<td class=\"row1\" width=\"100%\" align=\"center\"><font class=\"mainrosterbig\">$rankname</font></td></tr></table><br />";
    echo "<table border=0 width='100%' cellpadding='3'><tr><th width='10%'>Rank</th><th width='25%'><b>"._HANDLE."</b></th>";
    $counter = 1;
    while ($counter <= $tablenum) {
             $temp = "table_$counter";
               echo "<th width='15%'><b>".$$temp."</b></th>";
                $counter++;
            }
    echo "</tr>";
   while ( $rowa = $db->sql_fetchrow($resulta) ) {
      $rankname = $rowa["rankname"];
            $rank_image = $rowa["rank_image"];
        $tables = "";
        if ($table_1 != "" )
           $tables = $tables . ", `$table_1`";
        if ($table_2 != "" )
           $tables = $tables . ", `$table_2`";
        if ($table_3 != "" )
           $tables = $tables . ", `$table_3`";
        if ($table_4 != "" )
           $tables = $tables . ", `$table_4`";
        $result = $db->sql_query("SELECT `u_handle`, `uniqueid`$tables FROM `roster_members` WHERE `u_rank`='$rankname' ORDER BY unit");
        echo "<tr>";
      while ( $row = $db->sql_fetchrow($result) ) {
          $hname = $row["u_handle"];
          $uid = $row["uniqueid"];
            if ($rank_image =="") {
            $ri = " ;;";
            } else {
            $ri = "<img src='modules/roster/images/ranks/$rank_image' title='$rankname'>";
            } 
            $table1 = $row["$table_1"];
          $table2 = $row["$table_2"];
          $table3 = $row["$table_3"];
          $table4 = $row["$table_4"];
          echo "<td width='10%' class='row1' align='center'>$ri</td><td class='row1' width='25%'><a class=\"mainroster\" href=\"modules.php?name=$module_name&file=rosterprofile&handlename=$uid\">$hname</a></td>";
            //displays values of $table while it is under $tablenum, the amount of table inputs.
            $counter = 1;
            while ($counter <= $tablenum) {
                $temp = "table$counter";
      if ($$temp == "")
         $$temp = "N/A";
               echo "<td class='row1' width='15%'><font class=\"mainroster\">".$$temp."</font></td>";
                $counter++;
            }
        echo "</tr>";
        }

    }
    echo "</table><br /><hr noShade>";
}

}

else if ($displaytype == 2) {
$result = $db->sql_query("SELECT tablenum, table_1, table_2, table_3, table_4, table_5 FROM roster_main");
   while ( $row = $db->sql_fetchrow($result) ) {
      $tablenum = $row["tablenum"];
       $table_1 = $row["table_1"];
       $table_2 = $row["table_2"];
       $table_3 = $row["table_3"];
       $table_4 = $row["table_4"];
       $table_5 = $row["table_5"];
   }
    $resulta = $db->sql_query("SELECT `rankname` FROM `roster_ranks` ORDER BY `uniqueid`");
   while ( $rowa = $db->sql_fetchrow($resulta) ) {
      $rankname = $rowa["rankname"];
        $result1 = $db->sql_query("SELECT `uniqueid` FROM `roster_members` WHERE `u_rank`='$rankname'");

        $flag = $db->sql_num_rows($result1);

      if ($flag <= 1) {echo "<b>" . $rankname . "</b><hr width=150 align='left'>";}
      else  {$ending = findEnding($rankname); echo "<b>" . $rankname . $ending . "</b><hr width=150 align='left'>";}

        $test = $db->sql_fetchrow($result1);
        //displays empty if the rank has no members under it...
        if ($test == "")
           echo "<i>empty</i><br>";
        else {
         //lists the header for the table displaying what's what
          echo "<table border=0 width='100%' cellpadding='3'><tr><th><b>"._HANDLE."</b></th>";
            $counter = 1;
          while ($counter <= $tablenum) {
             $temp = "table_$counter";
               echo "<th><b>".$$temp."</b></th>";
                $counter++;
               }
          echo "</tr>";
           $tables = "";
           if ($table_1 != "" )
              $tables = $tables . ", `$table_1`";
           if ($table_2 != "" )
              $tables = $tables . ", `$table_2`";
           if ($table_3 != "" )
              $tables = $tables . ", `$table_3`";
           if ($table_4 != "" )
              $tables = $tables . ", `$table_4`";
           if ($table_5 != "" )
              $tables = $tables . ", `$table_5`";
           $resultb = $db->sql_query("SELECT `u_handle`, `uniqueid`$tables FROM `roster_members` WHERE `u_rank`='$rankname'");

           echo "<tr>";
         while ( $rowb = $db->sql_fetchrow($resultb) ) {
             $hname = $rowb["u_handle"];
             $uid = $rowb["uniqueid"];
               $table1 = $rowb["$table_1"];
             $table2 = $rowb["$table_2"];
             $table3 = $rowb["$table_3"];
             $table4 = $rowb["$table_4"];
             $table5 = $rowb["$table_5"];
             echo "<td class='row1'><a class=\"mainroster\" href=\"modules.php?name=$module_name&file=memberinfo&handlename=$uid\">$hname</a></td>";
               //displays values of $table while it is under $tablenum, the amount of table inputs.
               $counter = 1;
               while ($counter <= $tablenum) {
                   $temp = "table$counter";
         if ($$temp == "")
            $$temp = "N/A";
                  echo "<td class='row1'><font class=\"mainroster\">".$$temp."</font></td>";
                   $counter++;
               }
           }
echo "</tr></table><br>";
} //end else

    } //end of the rank loop
}

CloseTable();
include("footer.php");
?>


I have some disconnect between the two and am loosing my hair from scratching my head too much.

As always any help you guys can give is much appreciated. After I'm done with these I'm getting Telli to build me an Admin page for all this. icon_biggrin.gif If I attempt to do it myself I'll put myself in a coma. icon_neutral.gif


-Donovan


Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum