#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    6
    Rep Power
    0
    Thank you everyone that replied. However, there is still a problem. To see the changes to the MySQL database I have to restart the browser. How do I make the change visible instantly.(i.e when I press the "back to index" button)? I am using lynx , apache and redhat.


    index.php3
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    <html>
    <head><title>Web Database Sample Index</title>
    </head>

    <body bgcolor=#ffffff>
    <h1>Data from mytable</h1>
    <?
    mysql_connect("localhost","username","*password");


    $query = "SELECT name, phone FROM mytable";
    $result = mysql_db_query("test2", $query);

    if ($result) {
    echo "Found these entries in the database:<ul>";
    while ($r = mysql_fetch_array($result)) {
    $name = $r["name"];
    $phone = $r["phone"];
    echo "<li>$name, $phone";
    }
    echo "</ul>" ;
    } else {
    echo "No data.";
    }
    mysql_free_result($result);
    ?>

    <p><a href="add.php3">Add new entry </a>
    </body>
    </html>
    [/code]

    add.php3
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    <html>
    <head><title>Web Database Sample inserting </title>
    </head>

    <body bgcolor=#ffffff>
    <?
    if (isset($name) && isset ($phone)) {
    mysql_connect ("localhost", "username", "password");
    $query = "INSERT INTO mytable VALUES ('$name', '$phone')";
    $result = mysql_db_query("test2", "$query") ;

    if ($result) {
    echo "<p>$name was added to the database</p>" ;
    }
    }
    ?>

    <h1>Add an entry</h1>
    <form action="add.php3" method="post">
    Name: <input type=text name='name'><br>
    phone: <input type=text name='phone'><br
    <input type=submit name='submit'>
    </form>
    <p><a href="index.php3">Back to index</a>
    </body>
    </html>
    [/code]
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    35
    Rep Power
    15
    this is lynx not refreshing the page.

    ctrl - r to refresh

    HTH
    marty

Similar Threads

  1. Check MySQL Version thru PHP
    By wolftrap1 in forum PHP Development
    Replies: 2
    Last Post: February 11th, 2004, 09:51 PM
  2. Replies: 0
    Last Post: February 11th, 2004, 08:48 AM
  3. Replies: 5
    Last Post: February 3rd, 2004, 02:59 PM
  4. Help using a database and php to update a scores page.
    By deathsythe in forum PHP Development
    Replies: 0
    Last Post: February 2nd, 2004, 03:48 PM
  5. Replies: 0
    Last Post: January 31st, 2004, 03:15 AM

IMN logo majestic logo threadwatch logo seochat tools logo