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
https://forums.phpfreaks.com/topic/191681-field-list-error/
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
https://forums.phpfreaks.com/topic/191681-field-list-error/#findComment-1010367
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
https://forums.phpfreaks.com/topic/191681-field-list-error/#findComment-1010911
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
https://forums.phpfreaks.com/topic/191681-field-list-error/#findComment-1010917
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.