Most of my php and mysql mistakes are fairly easy to find. However, this one gives no symptom other than not updating the specified table. I have simplified the php and html code to just two fields in hopes of eliminating many sources for syntax errors.
All was working fine with a small test database and now after creating the full database with complete tables it has decided to fail. (aka I screwed something up!) Anyone have an idea on what needs fixin?
Here are some specifics of the db/tables.
Code:
MySQL 5.0.18-nt running on localhost as root@localhost
Users having access to "contacts"
User Host Type Privileges Grant
root localhost global ALL PRIVILEGES Yes
Table Records Type Collation Size Overhead
current_members 0 MyISAM latin1_general_ci 1.0 KB -
deleted_members 0 MyISAM latin1_general_ci 1.0 KB -
sessions 0 MyISAM latin1_general_ci 1.0 KB -
updated_members 0 MyISAM latin1_general_ci 1.0 KB -
userlog 0 MyISAM latin1_general_ci 1.0 KB -
users 0 MyISAM latin1_general_ci 1.0 KB
Field Type Collation Attributes Null Default Extra
UserID int(10) UNSIGNED No auto_increment
UserName varchar(15) latin1_general_ci No
Password varchar(15) latin1_general_ci No
RBS_date varchar(10) latin1_general_ci No
AccessPermitted int(3) UNSIGNED No 50
The data entry screen code:
HTML Code:
<head>
<title> Add a new member</title>
</head>
<body BGCOLOR="gray">
<table border="1" valign="top" align="left" cellpadding="0" cellspacing="0"
class="border" bgcolor="#EFEFCC" width="350">
<tr> </tr>
<form action="insertest2.php" method="post">
<tr><td align left>User Name: <input type="text" name="UserName"><br></td></tr>
<tr><td align left>Password Name: <input type="text" name="Password"><br></td></tr>
<tr><td align left><input type="Submit" value="save"></td></tr>
</table>
</form>
And the stripped down php code that updates the db table. $result shows "1" which means some kind of error in the select....but what????:
PHP Code:
<? $username1="root"; $password1=""; $database="contacts"; $AUsername=$_POST['UserName']; $APassword=$_POST['Password']; mysql_connect(localhost,$username1,$password1); $result=@mysql_select_db($database) or die( "Unable to select database"); echo "result= "; echo $result; $query = "INSERT INTO users ('UserID', UserName, Password) VALUES ('','$AUsername','$APassword')"; mysql_query($query); mysql_close(); ?> <td><font face="Arial, Helvetica, sans-serif"><a href="/addtest2.html"> Back to Add Member</a></font></td>
|