Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



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

Posts: 47
Trades: 0
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
 
 
Register now for full access!
Old 05-05-2006, 07:19 PM Re: Unknown mysql error condition
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
you cannot insert a value into an auto_increment field
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
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
Trades: 0
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,226
Name: Mike
Location: Mataro, Spain
Trades: 0
What is your query finally?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

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 Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB 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.13276 seconds with 12 queries