Results 1 to 6 of 6

Thread: A strange problem.

  1. #1
    Join Date
    Jul 2007
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default A strange problem.

    hai
    i have a mysql table named customer:

    s.no name phone
    ----------------------------------
    100 sam 2453
    210 george 5637
    98 mark 7382


    i have a page name index.php
    it displays s.no of the customer table like this


    The source code is:
    --------------------
    <a href="phone.php">100</a>
    <a href="phone.php">210</a>
    <a href="phone.php">98</a>

    ie output is
    --------
    100
    210
    98


    phone.php page is simple. its displaying the phone number of clicked customer.
    if a user click 100 phone.php should display 2453. (ie phone of s.no 100)
    if a user click 98 phone.php should display 7382 (ie phone of s.no 98)


    how can i do this.

  2. #2
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    You can use SELECT... to do this.

    Here's a good place to start.
    http://www.php-mysql-tutorial.com/
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  3. #3
    Join Date
    Jul 2007
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thank you tech_support.
    select option is a good choice.

    but with out using any form i want to solve this problem. using forms, using select option all r working fine

    withour using this forms i want the solution.

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Make your links like so:

    Code:
    <a href="phone.php?id={id_of_customer}">{id_of_customer}</a>
    Then in phone.php make it look something like so:

    Code:
    <?php
     require('connection.php'); //database connection
    
    $id = $_GET['id'];
    
     $info = mysql_query("SELECT * FROM `customers` WHERE `s.no`='$id'");
     if (mysql_num_rows($info)) { //if found in table
       while ($qry = mysql_fetch_array($info)) {
    ?>
      Customer Name: <?php echo $qry['name'];?> <BR>
      Phone Number:  <?php echo $qry['phone'];?>
    <?php
       }
     }
    ?>
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. #5
    Join Date
    Jul 2007
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default thank you Mr. thetestingsite

    thank you mr.thetestingsite.

    i got the solution from your code.

    thank you verymuch.

  6. #6
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Quote Originally Posted by sujith787 View Post
    thank you tech_support.
    select option is a good choice.

    but with out using any form i want to solve this problem. using forms, using select option all r working fine

    withour using this forms i want the solution.
    I was talking about MySQL Select....
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

Bookmarks

Posting Permissions

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