Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello, I seem to be having probl

Status
Not open for further replies.

kjspear

Programmer
Feb 13, 2002
173
US
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=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<h2>Registration Page</h2>
<form action=&quot;myusers.php&quot; method=POST>
<p>Please enter the login information which was emailed to you.<br>
User ID:
<input type=text name=&quot;users&quot; size=6 maxlength=&quot;6&quot;>
Password:
<input type=password name=&quot;passID&quot; size=6 maxlength=&quot;6&quot;>
Nickname:
<input type=text name=&quot;nickname&quot; size=10 maxlength=&quot;10&quot;>
<p> <input type=submit name=&quot;submit&quot; value=&quot;Done&quot;></p>
</form>
</body>
</html>


<?php
$conn=mysql_connect(&quot;localhost&quot;,&quot;mkt2000&quot;,&quot;chelsea7&quot;);
mysql_select_db(&quot;myloginDB&quot;,$conn);
$sql=&quot;INSERT INTO logins VALUES ('','users')&quot;;
$sql=&quot;INSERT INTO logins VALUES ('','passID')&quot;;
$sql=&quot;INSERT INTO logins VALUES ('','nickname')&quot;;
if (mysql_query($sql, $conn)){
echo &quot;entry successful!&quot;;
} else{
echo &quot;entry unsuccessful. Contact the Webmaster&quot;;
}
?>

I am using mysql 4 in an Windows XP professional environment with IIS 5.

Any assistance will be helpful.

Thank you.

Kyle
 
Is the register globals are turned off in php.ini?

try inserting values $HTTP_POST_VARS[&quot;users&quot;] etc. instead of $users..


--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top