Jump to content

Field list error?


Mythical

Recommended Posts

Hello there, i'm trying to create a login/register script for my sim game,

but i'm having a little trouble in doing so.

 

Everytime I attempt to test out my registration system, it fails, and I get this message:

Error: Unknown column 'username' in 'field list'

 

I've been led to believe that the problem is within my register script, here:

 

$newPlayer = @mysql_query("INSERT INTO players (`username`, `password`, `registered`) VALUES ('$uname', '$pass', '$date')") or die("Error: ".mysql_error());

 

Can anybody help me with this?

i'm very new to php and a little confused.

 

In case you are wondering, I do have a mysql database set up, and there is a column named 'username varchar 150' :)

 

Sincerely,

Mythical.

 

(Attached is the entire document, if you're curious ^^)

 

[attachment deleted by admin]

Link to comment
Share on other sites

it canot be column named username if mysql says that it doesn exists.

maybe its user_name or uname ?

maybe u traveled to another database or another host?

 

what about trying this

//connection

$query = mysql_query( "SELECT * FROM players" ); 
$columns = mysql_num_fields($query); 
for($i = 0; $i < $columns; $i++) 
{ 
    print mysql_field_name($columns,$i)."<br />"; 
}  

Link to comment
Share on other sites

yep..

I didi think that maybe u have col names called "name varchar 100" but that was like impossible :)

 

anyways

in the colum Field write name of the table field such id,username,userpass,title,post...

no extra stuf like varchar 100, int 10

 

u set field types (integer,double float, char,text, varchar) on "Type" and u set how length of the field in ()

 

Link to comment
Share on other sites

yes exactly

 

As sader just said, your field names have a space and a type as part of the field name.

 

Also all your fields are actually of type int which means they can store only numbers

It is a bad idea to have spaces in field names and field names should certainly not contain the type declaration

Link to comment
Share on other sites

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.