some php code needed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • whatsoever
    New Member
    • Sep 2006
    • 4

    some php code needed

    hi i have made a database let say estate agent which have 5 table and 10 queries
    i have connected it with php using the tutorial in w3school
    Code:
    <html>
    <body>
    <?php
    $conn=odbc_connect('db','','');
    if (!$conn)
    {exit("Connection Failed: " . $conn);}
    $sql="SELECT * FROM client";
    $rs=odbc_exec($conn,$sql);
    if (!$rs)
    {exit("Error in SQL");}
    echo "<table><tr>";
    echo "<th>firstname</th>";
    echo "<th>lastname</th></tr>";
    while (odbc_fetch_row($rs))
    {
    $fname=odbc_result($rs,"firstname");
    $lname=odbc_result($rs,"lastname");
    echo "<tr><td>$fname</td>";
    echo "<td>$lname</td></tr>";
    }
    odbc_close($conn);
    echo "</table>";
    ?>
    </body>
    </html>
    the result is
    firstname lastname
    JOHN KAY
    ALIN STEWART
    MIKE RITCHIE
    MARY TREGEAR
    PATRICK HARRISON
    RONALDO GERRAD

    my problem is i dont know how to bring the table name client and when i click the table name client i can get the information of that table

    do i have to write alot of code?

    can anyone please give me code to bring out one table name and when i click the table name
    i can get the content of the table
    and to bring out one query as well

    i will be grateful
    Last edited by ronverdonk; Oct 2 '06, 12:56 PM. Reason: Next time use code tags
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Do you mean that you are looking for a script that asks for the table name and, if filled in, will select the data from that table and display it?
    What have you developed so far for this user interface? Show us your code.

    Ronald :cool:

    Comment

    • whatsoever
      New Member
      • Sep 2006
      • 4

      #3
      Originally posted by ronverdonk
      Do you mean that you are looking for a script that asks for the table name and, if filled in, will select the data from that table and display it?
      What have you developed so far for this user interface? Show us your code.

      Ronald :cool:
      thank u very much for ur reply

      i have not written anything anycode for the user interface yet
      i will start it from tommarrow
      i am new to html ,ms access, and php
      so i am trying my best to understand html at the moment
      so i can make a simple interface

      one thing i understood is that may be i have to make some individual 20 30 page around and link them all through web interface page
      am i right?

      any help suggestion will do a great deal for me
      regards

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        You can do this in 2 pages, 1 for the user interface, 1 for the database select and display. The user interface page can, after the required data has been filled in, call the db page to select and display the actual db data.

        When you are more experienced in PHP, you can even do both things in 1 page only. But as a start, I would go for the 2 page solution here.

        Keep us informed on your progress and come back here when you need coding help.

        Ronald :cool:

        Comment

        Working...