Jump to content

Recommended Posts

Not sure what this is telling me :

myDownfall (this is showing the connection

Error with query: Column count doesn't match value count at row 1

 

 

Here is my php script..

$username=$_POST['username'];
$password=$_POST['password'];
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname']; 
$email=$_POST['email']; 
$age=$_POST['age']; 
$band=$_POST['band']; 
$description=$_POST['description']; 



$query = "INSERT INTO `users`(`username`, `password`, `firstname`, `lastname`, `email`, `age`, `band`, `description`) VALUES ('$username', '$password', '$firstname', '$lastname', '$email', '$age' '$band', '$descriprion')";

$result = mysql_query($query); 
if (!$result) { 
    $errormessage = mysql_error(); 
    echo "Error with query: " . $errormessage; 
    exit(); 
} 
printf ("These values were inserted into the database - %s %s %s", $username, $firstname, $lastname);          
?>

 

 

here is the html side

 

 

<table border="0" cellpadding="3" cellspacing="3">
<tr>
<td valign="top">
<form action="add2.php" method="POST">
Username :
</td>
<td>
<input type="text" class="forms" name="username" size="40" length="40" value="Username"><BR><BR />
</td>
</tr>
<tr>
<td valign="top">
Password :
</td>
<td><input type="password" class="forms" name="password" size="40" length="40" value=""><BR> <BR>
</td>
</tr>
<tr>
<td valign="top">
First Name :
</td>
<td><input type="text" class="forms" name="firstname" size="40" length="40" value="First Name"><BR> <BR>
</td>
</tr>
<tr>
<td valign="top">
Lastname :
</td>
<td><input type="text" class="forms" name="lastname" size="40" length="40" value="Last Name"><BR> <BR>
</td>
</tr>
<tr>
<td valign="top">
Email :</td>
<td><input type="text" name="email"  size="40" length="40" class="forms" value="Email"><BR> <BR></td></tr>
<tr>
<td valign="top">
Age :
</td>
<td><input type="text" class="forms" name="age" size="40" length="40" value="Age"><BR> <BR>
</td>
</tr>
<tr>
<td valign="top">
Favorite Band :
</td>
<td><input type="text" class="forms" name="band" size="40" length="40" value="Favorite Band"><BR> <BR>
</td>
</tr>
<tr>
<td valign="top">
Description :
</td>
<td>
<textarea cols="50" rows="8" name="description" class="forms"></textarea>
<BR> <BR>
</td>
</tr>
<tr>
<td>
            <input type="submit" name="submit" value="Submit" class="forms"> 

        </form> 
</td>
</tr>
</table>

 

 

and just because.. here is how i have my table setup..

 

 

id  int( No    auto_increment primary key  
username  varchar(25) No      
password  int(10) No      
firstname  varchar(20) No      
lastname  varchar(20) No      
email  varchar(30) No      
age  int(3) No      
band  varchar(20) No      
description  varchar(250) No      

No is Not Null

 

Any help with what it's doing would be cool..

Link to comment
https://forums.phpfreaks.com/topic/161623-solved-sign-up-script-problems/
Share on other sites

myDownfall

Error with query: Duplicate entry '0' for key 1

 

I've had this error before, i was playing with my script and trying different thigns and what i missed and i will go into the table and delete the only entry.. but it still doesn't want to work.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.