PHP
  Home arrow PHP arrow Page 5 - Doing More with phpMyAdmin (Part 2)
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Doing More with phpMyAdmin (Part 2)
By: Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 39
    2003-12-08


    Table of Contents:
  • Doing More with phpMyAdmin (Part 2)
  • The Ground Work
  • Total Recall
  • Tangled Relationships
  • Bookmark Bandit
  • Looking Up the Dictionary
  • History Lesson

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Doing More with phpMyAdmin (Part 2) - Bookmark Bandit
    ( Page 5 of 7 )

    Just as most browsers allow users to bookmark favorite Web sites, phpMyAdmin allows developers to bookmark complex queries, so that they can be easily reused over and over again. As an example, consider the following query, which returns a list of customers along with the services that they have opted for:

    SELECT clients.cname, services.sname 
    FROM branches, clients, branches_services, services 
    WHERE branches.bid = branches_services.bid 
    AND clients.cid = branches.cid 
    AND branches_services.sid = services.sid
    


    This query can easily be bookmarked by popping open the Query window (bottom left of the application) and entering the query above into the query box. Once a result set appears, simply scroll to the bottom of the results page, enter a name for the bookmark, and click the Bookmark this SQL-Query button to save the query to the bookmarks file.

    When you need to execute the query again, use the SQL tab to obtain a drop-down list of all previously-bookmarked queries. Find the query you bookmarked earlier, select it and Bob's your uncle!

    You can also use variables in such bookmarked queries. For example, if you want to specify the sid of the service in the query on a per-instance basis, simply alter the query string to look like this:

    SELECT clients.cname, services.sname 
    FROM branches, clients, branches_services, services 
    WHERE branches.bid = branches_services.bid 
    AND clients.cid = branches.cid 
    AND branches_services.sid = services.sid /* 
    AND services.sid = [VARIABLE] */ 
    


    Now, run the query. The first time around, phpMyAdmin will ignore the condition between the "/*" and "*/" comment marks and run the query after discounting that section of the query string. No matter; when the result set appears, bookmark this query and then use the SQL tab to run it again. This time, you'll be asked for a value for the sid variable, as seen here.

    While this is a good feature, be warned that it is still a little buggy: I could not use it with string variables correctly and, while it certainly offers a great way to store complex queries for reuse, it still needs some tweaking.

     
     
    >>> More PHP Articles          >>> More By Harish Kamath, (c) Melonfire
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    Stay green...Green IT