MySQL DB insertion problem
Posted: Sat Apr 03, 2004 11:42 am
Hello folks,
Can anybody help me with the following problem? I'm trying to create a simple page that will connect to my MySQL DB and update the contents using the script below. For some reason though, the content doesn't seem to update the DB tables- it just refreshes the page. Any ideas? Much appreciated if there are- it's getting a bit frustrating!
J
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="db_update_msw.php" method="post">
Mesh:
<input type="text" name="Mesh"><br>
Gauge:
<input type="text" name="Gauge"><br>
Diameter (mm):
<input type="text" name="Diameter"><br>
Aperture:
<input type="text" name="Aperture"><br>
Free Area (%):
<input type="text" name="Free_Area"><br>
<br>
<input type="Submit">
</form>
<?
$username="xxxxx";
$password="xxxxxx";
$database="xxxxxx";
mysql_connect('xxxxxxxxx',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO 'Mild Steel Wire' VALUES ('','$Mesh','$Gauge','$Diameter','$Aperture','$Free_Area')";
mysql_query($query);
mysql_close();
?>
</body>
</html>
Can anybody help me with the following problem? I'm trying to create a simple page that will connect to my MySQL DB and update the contents using the script below. For some reason though, the content doesn't seem to update the DB tables- it just refreshes the page. Any ideas? Much appreciated if there are- it's getting a bit frustrating!
J
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="db_update_msw.php" method="post">
Mesh:
<input type="text" name="Mesh"><br>
Gauge:
<input type="text" name="Gauge"><br>
Diameter (mm):
<input type="text" name="Diameter"><br>
Aperture:
<input type="text" name="Aperture"><br>
Free Area (%):
<input type="text" name="Free_Area"><br>
<br>
<input type="Submit">
</form>
<?
$username="xxxxx";
$password="xxxxxx";
$database="xxxxxx";
mysql_connect('xxxxxxxxx',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO 'Mild Steel Wire' VALUES ('','$Mesh','$Gauge','$Diameter','$Aperture','$Free_Area')";
mysql_query($query);
mysql_close();
?>
</body>
</html>