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
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);

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.