Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, November 11, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  View Button Config

phpMyEdit General     View Button Config
Post new topic   Reply to topic    
 
Kyle     Joined: 05 Jul 2010   Posts: 2  
Post Posted: 2010-07-05 11:26
Back to top  Reply with quote     

Hi, Im kind of new to php. Have tried this phpMyEdit and its exactly what im looking for. Although when I click view, i want it to return a single record details as it does as well as in include other details relative to that record.
I have other tables, linked by unique ids, is it possible to do what i require?

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2010-07-06 01:19
Back to top  Reply with quote     

other details?

 
Kyle     Joined: 05 Jul 2010   Posts: 2  
Post Posted: 2010-07-06 09:08
Back to top  Reply with quote     

I have about 5 tables that I require data from.
The 1st display shows my claims -> (upon clicking view) it must display all data from that initial table as well as display from the 5 other tables.
all the tables are linked via a column called "unique Id"

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2010-07-06 13:17
Back to top  Reply with quote     

It would be faster write your own PHP script to display information from the other tables. In View mode the query request (URL) would include something like pageName.php?PME_sys_operation=PME_op_View&PME_sys_rec=210

You could use the value of $_REQUEST['PME_sys_rec'] in the WHERE statement of your custom script. With inclusion of your script conditional upon $_REQUEST['operation'] = PME_op_View

It "might" be possible to do some sort of JOIN statement within phpMyEdit (though I doubt it) and it would take forever to figure it out. Faster to write a separate script to include below the call to the class file.

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2010-07-06 16:52
Back to top  Reply with quote     

Code:
// phpMyEdit form above, includes a domain_id and client_id field

new phpMyEdit($opts);

// The db connection is narmally closed within the class file.

// Comment out that closure in the class file, or create another db connection here.

// Ensure the form is not in List mode

if(isset($_REQUEST['PME_sys_operation'])){

   // If in View mode then $_REQUEST['PME_sys_rec'] should be non-empty

   if($_REQUEST['PME_sys_operation'] == 'PME_op_View' && !empty($_REQUEST['PME_sys_rec'])){

      echo "\n".'<h1>Contact Info</h1>';

      // Using the domain_id a/k/a $_REQUEST['PME_sys_rec'] for the currently viewed page, look up the client_id in this record

      $qry = sprintf('SELECT client_id FROM `%s`.`%s` WHERE `domain_id` = "%s" LIMIT 1', $opts['db'], $opts['tb'], $_REQUEST['PME_sys_rec']);

      if($row = @mysql_fetch_row(@mysql_query($qry))){

         $client_id = $row[0];

         // Look up the client_id from

         $opts['tb'] = 'my_contacts_table';

         $qry = sprintf('SELECT * FROM `%s`.`%s`  WHERE `contact_id` = "%s" LIMIT 1', $opts['db'], $opts['tb'], $client_id);

         if($res = @mysql_query($qry, $opts['dbh'])){

            $num_rows = @mysql_num_rows($res);

            if(empty($num_rows)){

               echo "\n".'<p>Cannot locate record id #'.$contact_id.'</p>';

            }else{

               echo "\n".'<table border="0" cellpadding="5" cellspacing="0" class="pme-main">';

               while($ary = @mysql_fetch_assoc($res)){

                  foreach($ary as $key => $val){

                     $$key = stripslashes(trim($val));

                  }

                  if($nickname != ''){

                     echo "\n".'<tr class="pme-row-0">';

                     echo "\n".'<td class="pme-key-0">Nickname</td>';

                     echo "\n".'<td class="pme-key-0">';

                     echo htmlspecialchars($nickname);

                     echo "\n".'</td>';

                     echo "\n".'</tr>'."\n";

                  }

                  if($primary_domain_name != ''){

                     echo "\n".'<tr class="pme-row-0">';

                     echo "\n".'<td class="pme-key-0">Primary Domain</td>';

                     echo "\n".'<td class="pme-key-0">';

                     echo htmlspecialchars($primary_domain_name);

                     echo "\n".'</td>';

                     echo "\n".'</tr>'."\n";

                  }

                  if($billing_address_1 != ''){

                     echo "\n".'<tr class="pme-row-0">';

                     echo "\n".'<td class="pme-row-0" nowrap>Billing Address 1</td>';

                     echo "\n".'<td class="pme-key-0">';

                     echo htmlspecialchars($billing_address_1);

                     echo "\n".'</td>';

                     echo "\n".'</tr>'."\n";

                  }

                  if($billing_address_2 != ''){

                     echo "\n".'<tr class="pme-row-0">';

                     echo "\n".'<td class="pme-key-0">Billing Address 2</td>';

                     echo "\n".'<td class="pme-key-0">';

                     echo htmlspecialchars($billing_address_2);

                     echo "\n".'</td>';

                     echo "\n".'</tr>'."\n";

                  }

                  if($billing_address_3 != ''){

                     echo "\n".'<tr class="pme-row-0">';

                     echo "\n".'<td class="pme-key-0">Billing Address 3</td>';

                     echo "\n".'<td class="pme-key-0">';

                     echo htmlspecialchars($billing_address_3);

                     echo "\n".'</td>';

                     echo "\n".'</tr>'."\n";

                  }

                  if($billing_address_4 != ''){

                     echo "\n".'<tr class="pme-row-0">';

                     echo "\n".'<td class="pme-key-0">Billing Address 4</td>';

                     echo "\n".'<td class="pme-key-0">';

                     echo htmlspecialchars($billing_address_4);

                     echo "\n".'</td>';

                     echo "\n".'</tr>'."\n";

                  }

                  if($email_1 != ''){

                     echo "\n".'<tr class="pme-row-0">';

                     echo "\n".'<td class="pme-key-0">Email 1</td>';

                     echo "\n".'<td class="pme-key-0">';

                     echo htmlspecialchars($email_1);

                     echo "\n".'</td>';

                     echo "\n".'</tr>'."\n";

                  }

               }

               @mysql_free_result($res);

               echo "\n".'</table>'."\n";

               echo "\n".'<br>';

               echo "\n".'<form target="_blank" class="pme-form" method="POST" action="data.php" name="PME_sys_form">';

               echo "\n".'<input type="hidden" name="PME_sys_rec" value="'.$client_id.'"><!-- client ID -->';

               echo "\n".'<input type="hidden" name="s" value="51"><!-- target page ID in CMS -->';

               echo "\n".'<input type="submit" class="pme-change" name="PME_sys_operation" value="Change">';

               // echo "\n".'<input type="hidden" name="PME_sys_sfn[0]" value="1">';

               // echo "\n".'<input type="hidden" name="PME_sys_cur_tab" value="PME_dhtml_tab0">';

               // echo "\n".'<input type="hidden" name="PME_sys_qfn" value="">';

               echo "\n".'</form>';

               echo "\n".'<br>';

            }

         }else{

            echo "\n".'<p class="red">'.htmlspecialchars(mysql_error()).'</p>';

         }

      }else{

         echo "\n".'<p class="red">'.htmlspecialchars(mysql_error()).'</p>';

      }

      echo "\n".'<hr size="1">';

   }

}


 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy