Jump to content

[SOLVED] Newbie here - basic PHP/MySQL error...


ShootingBlanks

Recommended Posts

Hello, all.  I checked around and couldn't find an answer to this, so I'm posting...

 

...I am VERY VERY new to PHP and MySQL.  I used phpMyAdmin to create a new database called "highscore".  In it is one table called "topten" with two columns, as you can see in the screencap below my message (to see how I set them up)...

 

...I go to my MySQL Command Line Client and type in the following to get the error in bold below:

 

mysql> use highscore

Database changed

mysql> INSERT topten (name,score) VALUES (matt,12);

ERROR 1054 (42S22): Unknown column 'matt' in 'field list'

 

What am I doing wrong here?  I just want to enter "matt" in the "name" column, and "12" in the "score" column of the "topten" table.  I assume it's something having to do with how I initially set up the table, but I'm not sure.  Any help would be greatly appreciated.  Thanks!!!...

 

sql.jpg

 

Link to comment
https://forums.phpfreaks.com/topic/57109-solved-newbie-here-basic-phpmysql-error/
Share on other sites

try this:

 

INSERT INTO topten SET

name = 'matt',

scroe = '12';

 

 

Just see if that works, your table looks fine to me and the error suggests that its interpreting one of your values as a table.

 

EDIT: your missing the INTO in  the below i think:

 

mysql> INSERT topten (name,score) VALUES (matt,12);

 

should be

 

mysql> INSERT INTO topten (name,score) VALUES (matt,12);

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.