MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old August 11th, 2000, 03:56 PM
carl carl is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 6 carl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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]

Reply With Quote
  #2  
Old August 13th, 2000, 09:58 AM
supine supine is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 35 supine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
this is lynx not refreshing the page.

ctrl - r to refresh

HTH
marty

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > "Re: insert into MySQL database with php not working!!"


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway