Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2011
    Location
    Tennessee
    Posts
    6

    Unanswered: Java script code please help!

    I do not know much at all about javascript but the below is the code I have now. I was told I need to use java script to get what I am looking for PLEASE HELP

    Code:
    <?php
    $connect = mysql_connect("host.address.com", "username", "password") or
    die ("Hey loser, check your server connection.");
    mysql_select_db("daobrien21");
    ?>
    <?php
    // Write out our query to get the list of bar names from our DB.
    $query = "SELECT Bar FROM Test";
    // Execute it, or return the error message if there's a problem.
    $result = mysql_query($query) or die(mysql_error());
    
    
    $dropdown = "<select name='Bar'>";
    
    //fetch_assoc will get the rows from the $result and put them into an array
    // the while loop then loops through the array wrapping the html code around the results
    // thus generating the dropdown with a list of your bar names
    while($row = mysql_fetch_assoc($result)) {
    $dropdown .= "\r\n<option value='{$row['Bar']}'>{$row['Bar']}</option>";
    }
    $dropdown .= "\r\n</select>";
    echo $dropdown;
    ?>
    <?php
    $query="select * from Test";
    $result = mysql_query("SELECT * FROM Test where City='Murfreesboro'");
    ?>
    <table border=1 style="background-color:#F0F8FF;" >
    <caption><EM>Murfreesboro Bars</EM></caption>
    <tr>
    <th>Bar Name</th>
    <th>City</th>
    <th>Address</th>
    <th>Phone</th>
    </tr>
    <?php
    while($row=mysql_fetch_array($result)){
    echo "</td><td>";
    echo $row['Bar'];
    echo "</td><td>";
    echo $row['City'];
    echo "</td><td>";
    echo $row['Address'];
    echo "</td><td>";
    echo $row['Phone'];
    echo "</td></tr>";
    }
    echo "</table>";
    ?>
    What I am looking to do is when someone selects the "bar name" from the drop down it edits the below table to just display that bars information. I cant seem to find how to do that.

  2. #2
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    I can't help you with the Javascript. But this is the SQL Server forum, not the MySQL forum. Try submitting your question there.
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  3. #3
    Join Date
    Aug 2011
    Location
    Tennessee
    Posts
    6

    hello

    Ok sorry. I will submit it there thanks.

Posting Permissions

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