MySQL tables

Hi everyone :slight_smile:

I am following the MySQL/PHP to flash integration tutorial (here). But there’s something I don’t get about setting up the MySQL structure: there’s this textfield at the second page that should be representing the table. I am using PHP My Admin, but I have absolutely no idea what the text in the field should be representing. It looks something like this:

**MySQL table named files:

------------------------------------------------
| filename | content |
------------------------------------------------
| myfile | my file contents are here |
| anotherfile | some stuff here |
------------------------------------------------

where filename is a varchar and content is a blob. This is the nice part. See how this is like a regular file system? It makes life simple as you can now execute queries like:

SELECT content FROM file WHERE filename=ā€˜myfile’;
**

Can someone please tell me what I have to do exactly to achieve this ?

that what would happen if you did the command in DOS. because your using phpmyAdmin you will not see the results like that. i did the same tutorial and got it to work. dont worry about that

I know it won’t look exactly the same, but I don’t see ANY stucture in it at all. Can you explain me ?

ok, i am new to mysql and php as well, so you might want to look up jubba on this topic, but here goes.

filename and content are fieldsin a table called files. filename is a varchar and content is a blob(setting up mySql table). in mysql you can use textfiles(.sql) to run database query’s and stuff like that. i believe that’s what the author of that tute is trying to achieve, howveer i think it could have been explained better. since your using phpadmin, just insert some data into to table fields named filename and content. that is what i did, but agian I AM NEW to this just like you, so this is probably not the best explaination you can get.

hope i helped

So, what you did: You created a table called files which has 2 fields. The names of those fields are filename and content, where filename is a varchar and content is a blob (I’m with you so far, but you said and content is a blob(setting up mySql table). Does this mean that a blob creates another table in the table files ? Or does it mean that you have to set these values when setting up the files table ?) So anyway, I have a table called files now, with two fields in which filename is a varchar and content is a blob. So now I have to fill in something in the Length/Values field ? Meh I’ll give it a try…

Thanks for your help Digital :slight_smile:

[EDIT] Hmmm, when I fill in something in those fields and try to create the table, it gives me an error :

CREATE TABLE `files` (

`filename` VARCHAR( file1 ) NOT NULL ,
`content` BLOB( something ) NOT NULL 
) 

MySQL returned: 


You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'file1) NOT NULL, `content` BLOB(something) NOT NULL)' a

What the ? [/EDIT]

CREATE TABLE `files` (

`filename` VARCHAR( file1 ) NOT NULL , `content` BLOB( something ) NOT NULL 
) 

try all one line. but you do not have to enter data like that. htere shoudl be an option where textfields appear and all you have to do is enter the info. phpAdmin does the SQL query for you.

So anyway, I have a table called files now, with two fields in which filename is a varchar and content is a blob. So now I have to fill in something in the Length/Values field ? Meh I’ll give it a try…

yes blob is the legnth. keep me posted and i will try to help the best i can.

That’s what I did, I filled in the fields and it gives me the error, that’s why I don’t get it :-\ Thanks for your help, it’s really appreciated :slight_smile:

ok so then its the ā€œnot nullā€, try changing that around. btw i found that the tutorial you are following was not good at all :frowning: try something else, i have a great book at home, i will scan you the tute they have if you would like

I would love it :slight_smile: Thanks ! :slight_smile: hug

You can send it to me: questy999@hotmail.com (that’s my junk mail address cuz you never know with mailbots … )

lol yea cool man, which host are you using? ipower? i’ve been having real difficulties with php and sql, but i am starting to get the hang of it, but problems like you are having im not too good at helping, but i will def send you the files. hey did you get it to work?(the sql statement)

I’m using asianillusion.com free subdomain hosting. I still haven’t got the MySQL stuff to work :-\ I tried changing the not null to null and backwards, but it still gives the error message …

crap ok when i get home ill look at my files and maybe we can figure this thing out

Ok :thumb: I’m 6 hours before you guys in America, so it will probably be night for me when you get home.

YEAH !!! Got it to work !! I used this tutorial : tutorial. Woohoow !

great, i love to see people who try, get things to work :slight_smile:

thanks for that link, it looks a lot better then the one i did, i will use asap for my news on my new site :slight_smile: thanks again and glad to see you got it working

btw, your english is great. didnt even know you werent from the US

Thanks :slight_smile: