|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
this is lynx not refreshing the page.
ctrl - r to refresh HTH marty |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > "Re: insert into MySQL database with php not working!!" |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|