Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2004
    Location
    Northpole :)
    Posts
    118

    Link to data in PHP...

    Hey,
    I'm trying to do an App Process script..And I'm trying to figure out how to make a page with the list of Apps...just their ID maybe, or usernames and a link to a page with full details of the application. The details of the apps are taken from the MySQL database after the user sent their application.

    Can anyone help me write that script?

  2. #2
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    25
    If you show some of the variables that you use, and what you use for table names I could write you up a simple script for you to build off of
    In the works with a new startup

  3. #3
    Join Date
    Feb 2004
    Location
    Northpole :)
    Posts
    118
    the table name is app, columns are..:

    ID
    Forum_Username
    Desired_Username
    Desired_Password
    Desired_Domain
    Email
    Plan_Chosen
    Current_Website
    Site_Description

  4. #4
    Join Date
    Jul 2003
    Location
    Kuwait
    Posts
    5,099
    Try this (untested, but should work)

    Filename : config.php
    PHP Code:

    /*This is the name of the database
    which has your app table.*/
    $db_name "application";

    /*This is the username with
    which you will access the database
    server.*/
    $db_uname "appuser";

    /*This is the password for the $db_uname user.*/
    $db_pass "secret";

    /* Now we attempt a connection */

    $conn mysql_connect("localhost",$db_user$db_pass);

    if (!
    $conn) { die(mysql_errno()." : ".mysql_error()); }

    /* Select our database */

    $status mysql_select_db($db_name);

    if (!
    $status) { die(mysql_errno()." : ".mysql_error()); }

    //~EOF 
    Filename : app.php (you can change this)

    PHP Code:
    //Include the config.php file
    require_once 'config.php';

    //Turn up error reporting
    error_reporting(E_ALL);

    /* Step 1 -- Check to see if this script was called directly. If it was, then we need to display the "master" table of all the applications */

    if (!isset($_GET['id']))
    {
       
    /* Since this is the master table, we won't include all the information, just a few details */
       
    $query "SELECT ID, Forum_Username, Desired_Username, Desired_Domain, Plan_Chosen FROM app";

       
    $result mysql_query($query);

        
    //Did it execute properly?

        
    if(!$result) { die (mysql_error()." : ".mysql_error()); }

         
    //Table header
         
    echo '<table border="0">'."\n";
         echo 
    '<tr><td colspan="5">Please click on the ID to get more details</td></tr>'."\n";
         echo 
    '<tr><td>Id</td><td>Forum ID</td><td>Desired ID</td><td>Desired Domain</td><td>Plan</td></tr>'."\n";
          
        
    //Now lets fetch the details

        
    while($row mysql_fetch_assoc($result))
        {
             echo 
    '<tr><td><a href="'.$_SERVER['PHP_SELF'].'?id='.$row['ID'].'">'.$row['ID'].'</a></td>'."\n";
             echo 
    '<td>'.$row['Forum_Username'].'</td>'."\n";
             echo 
    '<td>'.$row['Desired_Domain'].'</td>'."\n";
             echo 
    '<td>'.$row['Plan_Chosen'].'</td></tr>'."\n";
         }

         
    //Close our table
         
    echo '</table>';

    }

    /** Step 2 -- We have been called by our script, so we need to display all the information about an application **/

    if (isset($_GET['id']) && is_numeric($_GET['id']))
    {
        
    // Our new detailed query
        
    $query "SELECT * FROM app WHERE ID = '".$_GET['id']."' LIMIT 1";
         
       
    $result mysql_query($query);

        
    //Did it execute properly?

        
    if(!$result) { die (mysql_error()." : ".mysql_error()); }

         
    /* Since its only one user, we don't need a loop */

         
    $row mysql_fetch_assoc($result);

         
    //Display our results
         
    echo '<table border="0">'."\n";
         while (list(
    $column,$value) = each($row))
         {
             
    //Start our row
             
    echo '<tr>';
         
             
    //Do some intelligent string processing 
             
    if (strpos($column,"_") === FALSE)
             { 
                  echo 
    '<td>'.$column.'</td>';

             } else { 
                 
                 echo 
    '<td>'.str_replace("_"" ",$column).'</td>';
             }
             echo 
    '<td>'.$value.'</td>';

              
    //Close our row

              
    echo '</tr>';
          }

          
    //Close our table
          
    echo '</table>';

    Of course, you'll have to fix any syntax errors, etc. Let me know if you have any questions.
    In order to understand recursion, one must first understand recursion.
    If you feel like it, you can read my blog
    Signal > Noise

  5. #5
    Join Date
    Feb 2004
    Location
    Northpole :)
    Posts
    118
    dang...some expert level script right there..to me anyway..

    Thanks fyrest i'll figure my way around that script hehe.

  6. #6
    Join Date
    Feb 2004
    Posts
    772
    Hi ,

    Please try to follow the steps may be itl resolve your problem.

    First design a database of details of applications with different columns(Userid, username, details.....) Then you create a front end HTML page with drop down menu ( with complete list of user names or user ids ) .
    Here get the list through database query. Then write the code in such a way by selecting any name it will automatically display detailed list of selected name in which the name got through from drop down menu.

    HTML FORM ( DROP DOWN LIST <-> DATABASE )
    ON SELECTION
    -> GIVE LIST OF INDIVIDUAL DETAILS (PHP)

    Please have a look into this following URL

    http://www.indiwiz.com/web/ServerSide/61
    http://www.databasejournal.com/featu...0897_1469211_1

    Regards,

    Bright


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •