Jump to content

Recommended Posts

I have been banging my head on this for hours... I am sure it is something stupid, but I can't find it.  I would appreciate it if someone could find the loop here and see what's going on...

 

 


<?php
   include 'C:\Domains\syluntspace.com\wwwroot\vmware\inc\my.php';

      $db = mysql_connect("$server", "$user", "$password");
      mysql_select_db('mentor', $db) or die ('Cannot connect to $db_Database : ' . mysql_error());

   $tse_id = $_GET['id'];

   $result = mysql_query ("SELECT DATE_FORMAT(tse.tse_start, '%M %d, %Y') AS tse_start1, tse.tse_id, tse.tse_name, tse.tse_mentorname, tse.tse_mgr, tse.tse_grpid, DATE_FORMAT(tse.tse_vi3, '%M %d, %Y') AS tse_vi31, DATE_FORMAT(tse.tse_estlive, '%M %d, %Y') AS tse_estlive1, DATE_FORMAT(tse.tse_golive, '%M %d, %Y') AS tse_golive1, DATE_FORMAT(tse.tse_vcp, '%M %d, %Y') AS tse_vcp1, tse.tse_vcpver, tse.tse_ismentor, tse.tse_ismgr, tse.tse_level, tse.tse_weekorder, tse.tse_bootdone, sme.sme_id, sme.sme_name, mgmt.mgmt_id, mgmt.mgmt_name
                           FROM tse, sme, mgmt, weeks, weekorder
                           WHERE $id = tse.tse_id and sme.sme_id = tse.tse_grpid and mgmt.mgmt_id = tse.tse_mgr") or die(mysql_error());



while($row = mysql_fetch_array($result))
      {

$tse_id   = $row['tse_id'];
$tse_name = $row['tse_name'];
$tse_mentorname = $row['tse_mentorname'];
$tse_mgr  = $row['tse_mgr'];
$tse_grpid   = $row['tse_grpid'];
$tse_start   = $row['tse_start1'];
$tse_vi3  = $row['tse_vi3'];
$tse_estlive = $row['tse_estlive1'];
$tse_golive  = $row['tse_golive1'];
$tse_vcp  = $row['tse_vcp1'];
$tse_vcpver  = $row['tse_vcpver'];
$tse_ismentor   = $row['tse_ismentor'];
$tse_ismgr   = $row['tse_ismgr'];
$tse_level = $row['tse_level'];
$tse_weekorder  = $row['tse_weekorder'];
$tse_bootdone   = $row['tse_bootdone'];
$sme_id = $row['sme_id'];
$sme_name = $row['sme_name'];
$mgmt_id = $row['mgmt_id'];
$mgmt_name = $row['mgmt_name'];

echo '<table width="90%" cellspacing="1" cellpadding="1" border="0">
   <tr><td width="20%" height="1"><b>TSE Name:</b></td><td width="20%" height="1">' . $tse_name . '</td><td width="70%" height="1"></td></tr>
   <tr><td width="20%" height="1"><b>Mentor:</b></td><td width="20%" height="1">' . $tse_mentorname . '</td><td width="70%" height="1"></td></tr>
   <tr><td width="20%" height="1"><b>Manager:</b></td><td width="20%" height="1">' . $mgmt_name . '</td><td width="70%" height="1"></td></tr>
   <tr><td width="20%" height="1"><b>Group:</b></td><td width="20%" height="1">' . $sme_name . '</td><td width="70%" height="1"></td></tr>
     <tr><td width="20%" height="1"><b>TSE Level:</b></td><td width="20%" height="1">' . $tse_level . '</td><td width="70%" height="1"></td></tr>';


if ($tse_ismentor == '1'){
echo     '<tr><td width="20%" height="1"><b>TSE is a Mentor:</b></td><td width="20%" height="1"> Yes </td><td width="70%" height="1"></td></tr>';
   }
   else{
echo     '<tr><td width="20%" height="1"><b>TSE is a Mentor:</b></td><td width="20%" height="1"> No </td><td width="70%" height="1"></td></tr>';
   }


echo  '<tr><td width="20%" height="1"><b>VI3 Class Date:</b></td><td width="20%" height="1">' . $tse_vi3 . '</td><td width="70%" height="1"></td></tr>';


    if ($tse_bootdone == '1'){
echo     '<tr><td width="20%" height="1"><b>Bootcamp Complete:</b></td><td width="20%" height="1"> Yes </td><td width="70%" height="1"></td></tr>';
   }
   else{
echo     '<tr><td width="20%" height="1"><b>Bootcamp Complete:</b></td><td width="20%" height="1"> No </td><td width="70%" height="1"></td></tr>';
   }

echo   '<tr><td width="20%" height="1"><b>Est. Go Live Date:</b></td><td width="20%" height="1">' . $tse_estlive . '</td><td width="70%" height="1"></td></tr>
   <tr><td width="20%" height="1"><b>Go Live Date:</b></td><td width="20%" height="1">' . $tse_golive . '</td><td width="70%" height="1"></td></tr>
   <tr><td width="20%" height="1"><b>VCP Date:</b></td><td width="20%" height="1">' . $tse_vcp . '</td><td width="70%" height="1"></td></tr>
   <tr><td width="20%" height="1"><b>VCP Version:</b></td><td width="20%" height="1">' . $tse_vcpver . '</td><td width="70%" height="1"></td></tr></table>';




  }


?>

 

 

 

Thanks in advance,

 

Chris

Link to comment
https://forums.phpfreaks.com/topic/83873-find-my-loop/
Share on other sites

   $tse_id = $_GET['id']; // you define $tse_id

   $result = mysql_query ("SELECT DATE_FORMAT(tse.tse_start, '%M %d, %Y') AS tse_start1, tse.tse_id, tse.tse_name, tse.tse_mentorname, tse.tse_mgr, tse.tse_grpid, DATE_FORMAT(tse.tse_vi3, '%M %d, %Y') AS tse_vi31, DATE_FORMAT(tse.tse_estlive, '%M %d, %Y') AS tse_estlive1, DATE_FORMAT(tse.tse_golive, '%M %d, %Y') AS tse_golive1, DATE_FORMAT(tse.tse_vcp, '%M %d, %Y') AS tse_vcp1, tse.tse_vcpver, tse.tse_ismentor, tse.tse_ismgr, tse.tse_level, tse.tse_weekorder, tse.tse_bootdone, sme.sme_id, sme.sme_name, mgmt.mgmt_id, mgmt.mgmt_name
                           FROM tse, sme, mgmt, weeks, weekorder
                           WHERE $id = tse.tse_id and sme.sme_id = tse.tse_grpid and mgmt.mgmt_id = tse.tse_mgr") or die(mysql_error()); // you use $id

in your query you use variable $id that is not set yet

Link to comment
https://forums.phpfreaks.com/topic/83873-find-my-loop/#findComment-426964
Share on other sites

The problem is that instead of returning 1 set of values it repeats the same thing over and over again.  I want one set of data - 1 time :)

 

 

the $id comes from the previous page - that part works fine.

 

I realize the loop starts here while($row = mysql_fetch_array($result)) - what I wanted to know was why it keeps repeating - where does it get stuck?

 

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/83873-find-my-loop/#findComment-428201
Share on other sites

Does your loop end? What do you result looks like?

Have you tried simplifying it?

 

<?php
   include 'C:\Domains\syluntspace.com\wwwroot\vmware\inc\my.php';

      $db = mysql_connect("$server", "$user", "$password");
      mysql_select_db('mentor', $db) or die ('Cannot connect to $db_Database : ' . mysql_error());

   $tse_id = $_GET['id'];

   $result = mysql_query ("SELECT DATE_FORMAT(tse.tse_start, '%M %d, %Y') AS tse_start1, tse.tse_id, tse.tse_name, tse.tse_mentorname, tse.tse_mgr, tse.tse_grpid, DATE_FORMAT(tse.tse_vi3, '%M %d, %Y') AS tse_vi31, DATE_FORMAT(tse.tse_estlive, '%M %d, %Y') AS tse_estlive1, DATE_FORMAT(tse.tse_golive, '%M %d, %Y') AS tse_golive1, DATE_FORMAT(tse.tse_vcp, '%M %d, %Y') AS tse_vcp1, tse.tse_vcpver, tse.tse_ismentor, tse.tse_ismgr, tse.tse_level, tse.tse_weekorder, tse.tse_bootdone, sme.sme_id, sme.sme_name, mgmt.mgmt_id, mgmt.mgmt_name
                           FROM tse, sme, mgmt, weeks, weekorder
                           WHERE $id = tse.tse_id and sme.sme_id = tse.tse_grpid and mgmt.mgmt_id = tse.tse_mgr") or die(mysql_error());



while($row = mysql_fetch_array($result))
      {
          echo "<pre>";
          print_r($row);
          echo "</pre>;
      }

 

Also, what does your include accomplish? Nothing as far as I can see. What is in the file in question?

Link to comment
https://forums.phpfreaks.com/topic/83873-find-my-loop/#findComment-428206
Share on other sites

the code you provided does the same thing.... repeats 16 times

 

the result (my code) looks like this...

 

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

TSE Name: tsename

Mentor: mntname

Manager: mgrname

Group: Networking

TSE Level: 1

TSE is a Mentor: No

VI3 Class Date:

Bootcamp Complete: Yes

Est. Go Live Date:

Go Live Date:

VCP Date:

VCP Version: 0.0

 

Link to comment
https://forums.phpfreaks.com/topic/83873-find-my-loop/#findComment-428313
Share on other sites

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.