Hello,
I seem to be having problems inserting records into a database using mysql. I could use the INSERT command using the mysql monitor command line. However, when I try to use it in PHP, it doesn't insert. Nothing happens. No errors either. If I put the '$' in front of the fields such as
$sql="INSERT INTO logins VALUES ('','$users')";
I get a varible not defined error. Here is the code I used below;
<html>
<head>
<title>Registration Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<h2>Registration Page</h2>
<form action="myusers.php" method=POST>
<p>Please enter the login information which was emailed to you.<br>
User ID:
<input type=text name="users" size=6 maxlength="6">
Password:
<input type=password name="passID" size=6 maxlength="6">
Nickname:
<input type=text name="nickname" size=10 maxlength="10">
<p> <input type=submit name="submit" value="Done"></p>
</form>
</body>
</html>
<?php
$conn=mysql_connect("localhost","mkt2000","chelsea7"
mysql_select_db("myloginDB",$conn);
$sql="INSERT INTO logins VALUES ('','users')";
$sql="INSERT INTO logins VALUES ('','passID')";
$sql="INSERT INTO logins VALUES ('','nickname')";
if (mysql_query($sql, $conn)){
echo "entry successful!";
} else{
echo "entry unsuccessful. Contact the Webmaster";
}
?>
I am using mysql 4 in an Windows XP professional environment with IIS 5.
Any assistance will be helpful.
Thank you.
Kyle
I seem to be having problems inserting records into a database using mysql. I could use the INSERT command using the mysql monitor command line. However, when I try to use it in PHP, it doesn't insert. Nothing happens. No errors either. If I put the '$' in front of the fields such as
$sql="INSERT INTO logins VALUES ('','$users')";
I get a varible not defined error. Here is the code I used below;
<html>
<head>
<title>Registration Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<h2>Registration Page</h2>
<form action="myusers.php" method=POST>
<p>Please enter the login information which was emailed to you.<br>
User ID:
<input type=text name="users" size=6 maxlength="6">
Password:
<input type=password name="passID" size=6 maxlength="6">
Nickname:
<input type=text name="nickname" size=10 maxlength="10">
<p> <input type=submit name="submit" value="Done"></p>
</form>
</body>
</html>
<?php
$conn=mysql_connect("localhost","mkt2000","chelsea7"
mysql_select_db("myloginDB",$conn);
$sql="INSERT INTO logins VALUES ('','users')";
$sql="INSERT INTO logins VALUES ('','passID')";
$sql="INSERT INTO logins VALUES ('','nickname')";
if (mysql_query($sql, $conn)){
echo "entry successful!";
} else{
echo "entry unsuccessful. Contact the Webmaster";
}
?>
I am using mysql 4 in an Windows XP professional environment with IIS 5.
Any assistance will be helpful.
Thank you.
Kyle