PHPMyAdmin

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

I am wanting to learn databases in PHP so I got phpmyadmin but I have no idea where to start,

I go to create a table with four fields, but get an error

I filled out the fields like this

And get this error

What am I doing wrong?

He has: 1,016 posts

Joined: May 2002

I personally think you're trying to learn SQL the wrong way. The best way is to get a good book and learn it step by step from the start or you could also do tutorials. But to install phpMyAdmin and start there, BAD IDEA! phpMyAdmin is just a web tool/interface for SQL, nothing more.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

CHAR fields expect an integer value in the "Length/Values" textbox in phpMyAdmin. How long can the character string be for that field? I believe that the values you put in that field would be belong in the "Default" textbox.

Mark Hensler
If there is no answer on Google, then there is no question.

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

Quote: Originally posted by zollet
I personally think you're trying to learn SQL the wrong way. The best way is to get a good book and learn it step by step from the start or you could also do tutorials. But to install phpMyAdmin and start there, BAD IDEA! phpMyAdmin is just a web tool/interface for SQL, nothing more.

I would love to buy a book but...I have no money Sad though I am looking for tutorials though Smiling

Mark: Thanks, I got the table made and added a few extra rows of "information" but it doesn't show up... Confused

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

uh... can you discribe what your doing or looking at?

..oh, and pictures always help. Wink (but not always required)

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

Busy's picture

He has: 6,151 posts

Joined: May 2001

i don't think Length/Set can be 'things', think it has to be a value, try put it in the default (i'd just loose it), oops just read back and saw Mark said similar thing.

you also need more tables, id, img_width and what you have can be other things, other than CHAR, img_height etc could be INT(4) as you wouldn't have an image over 9999 pixels high, img_src could be VARCHAR(25) if you plan on using image names over 25 letters/numbers long

you should really learn this yourself, but here is one I made earlier Smiling

CREATE TABLE `imagesite` (
`pid` int(5) NOT NULL auto_increment,
`pname` varchar(25) NOT NULL default '',
`pextn` varchar(4) NOT NULL default '',
`pwidth` int(4) NOT NULL default '0',
`pheight` int(4) NOT NULL default '0',
`phits` int(6) NOT NULL default '1',
PRIMARY KEY (`pid`),
UNIQUE KEY `pid` (`pid`),
KEY `pid_2` (`pid`)
) TYPE=MyISAM;

this is part of what I actually use on my site
pid is the images id number
pname is the images name (no format as I change them)
pextn is the extension, .jpg, .gif or .png
pwidth is images width default is 0 for no reason
pheight is images height default is 0 for no reason
phits is how many times it's viewed - totally optional, default is 1 for math problem i had with another section (can't multipy by 0)

this works but may not be the proper way to do it, just one way i figured to do it. I'm still a newbie at this stuff too but you are best to learn how to type out the mysql commands and excute with PHP, thanks to Mairving it was one of the first thing I learnt about it and am glad I did or I'd be stuck with only using phpmyadmin and not knowing what/why/where, even thou I still havent got the full grasp of it - getting there thou.

They have: 8 posts

Joined: Dec 2002

As one who is currently in the learning process about mySQL and such myself, I second the thing about getting a bookk. I've bought 4 I think LOL

BUT if that's not an option, you need to start with the basics. Learn what the various field definitions are before you try working with them. Learn which ones need lengths set, and what's acceptable. Do some command line database building. You gotta take it slow, learn the basics, and build off of that.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.