Reply
Unknown mysql error condition
Old 05-05-2006, 11:58 AM Unknown mysql error condition
Experienced Talker

Posts: 47
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>
Frodocyber is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 05-05-2006, 07:19 PM Re: Unknown mysql error condition
chrishirst's Avatar
Super Moderator

Latest Blog Post:
Am I impressed or what?
Posts: 14,831
Location: Blackpool. UK
you cannot insert a value into an auto_increment field
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-07-2006, 08:57 AM Re: Unknown mysql error condition
Experienced Talker

Posts: 47
I deleted 'UserID', from the INSERT query and as you suggested. Still same result....nothing! No error displayed and no new row inserted. Other thoughts on syntax or maybe mysql bug???
Frodocyber is offline
Reply With Quote
View Public Profile
 
Old 05-10-2006, 05:38 AM Re: Unknown mysql error condition
mtishetsky's Avatar
King Spam Talker

Posts: 1,117
Name: Mike
Location: Mataro, Spain
What is your query finally?
__________________
Free Mobile Phone Themes

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Reply     « Reply to Unknown mysql error condition
 

Thread Tools

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12032 seconds with 12 queries