PDA

View Full Version : PHPMyAdmin help



mwalsh62
11-06-2007, 07:23 PM
Hi all,

I'm taking my first leap into databases (for a database search to include on my site), have gotten as far as setting up tables in phpMyAdmin, and hit a brick wall. I need to research meanings of various information queries (Field, Type, Collation, Attributes, etc.). Can anyone point me towards tutorials, or the like, that will explain these in somewhat simple language? The few I've tried through Google are either outdated, or beyond my level.

Thanks in advance,

mwalsh62
11-06-2007, 08:12 PM
Hi again,
I may have found what I was looking for, will still be grateful for any pointers!

Thanks again,

Watdaflip
11-06-2007, 08:41 PM
Heres a quick rundown.

"Field" is a column name. As I assume you know, a database is just a set of tables. The horizontal is columns, each needing a unique identifier. This can be just about anything, but there are some words that are reserved, meaning you can't name your column a word that is reserved.

"Type" is the data type, here is a list of most of the data types
http://www.htmlite.com/mysql003.php

"Length/Values" is the character length a variable can be stored. For instance say you want to have a field called year, and want the numerical value of a year stored in that column. You would then make the "Length" equal to 4, because there are 4 characters in a year (2007 is 4 characters).

"Default" is the default value for that column if a value is not specified when a new row is added to the table

"Extra" only has auto_increment. If you assign a column to auto-increment then whenever a new row is added, it will automatically make the value 1 more then the previous entry. This will number the rows 1-n, n being the total number of rows that have been added to that point. It is very useful to assign an id to each row in the table.

The last thing you should be concerned with is the "Primary", which is the primary column for the table. In most cases this is set the id column for a table, auto-increment requires the column be the primary.

I hope that helps

mwalsh62
11-06-2007, 09:48 PM
Thanks, for the reply, it was helpful.

The biggest stumbling block for me is that I cannot find a manual that explains the nuts and bolts of phpMyAdmin and the database I've created. I've found overview of SQL, very necessary and helpful, but it doesn't explain the operation of MyAdmin. For instance, where is my database? How do I add to, delete from? Any direction from any source would be welcome. I don't need my hand held, just a friendly shove!

navaldesign
11-06-2007, 10:13 PM
Databases appear in the left column of phpMyAdmin (if any. After you select a database (from those that exist, if you have created some), the tables appear beneath. Select the table you want to work with or add tables, if you don't have any.

Once a table has been populated with some listings, you can edit or delete any of the contained info, clicking on the relevant icons

mwalsh62
11-06-2007, 11:08 PM
Hi Naval,

Yes, I'm with you up until population. How do I put data in my database? I have a table with 9 fields, how do I populate those fields?

Watdaflip
11-07-2007, 01:04 AM
Using phpMyAdmin, once you select the table, you can click the "Insert" button. This will allow you to add a row to the database.

mwalsh62
11-07-2007, 01:14 AM
Okay, a little success!

I had been looking at that, the "Function" column backed me off. Is it necessary to add a function? This is why I am looking for a source to read. Everything I've found out there assumes I know what I am doing! It's hard to find a good teacher through Google.

Thanks to both of you, I'm going to keep messing with it.

navaldesign
11-07-2007, 04:53 AM
There is no practical meaning in using phpMyAdmin to populate a database. It was designed with DB creation / maintainance in mind and not management.

If you can explain a bit what you are trying to acheive, we can maybe provide some more useful info.

Searc scripts usually do NOT require you to manually do anything, they have an installation wizard that creates the tables and then the content is added by the script itself.

mwalsh62
11-07-2007, 01:25 PM
There is no practical meaning in using phpMyAdmin to populate a database. It was designed with DB creation / maintainance in mind and not management.

If you can explain a bit what you are trying to acheive, we can maybe provide some more useful info.

Searc scripts usually do NOT require you to manually do anything, they have an installation wizard that creates the tables and then the content is added by the script itself.

Hi Naval,

What I am trying to accomplish is a searchable database similar to the one found here (http://www.allaboutbeer.com/brewpubs/), not a site search. I assume that I will manually have to populate the database.

Thanks for your time,

navaldesign
11-07-2007, 02:56 PM
Hmm... . populating a database table is much simpler (especially if you want the user's to input the data themselves).
Simply create a form with the fields you want, install ABVFP and process the form with it. Whenever a user submits the form, the data wil be automatically stored in the database. Not only, but you don't even have to create the table, ABVFP wil do it automatically for you.

The search part is an entirely different issue. If the search is only for you, you can do it either through phpMyAdmin, or through a dedicated script. if the search is intended for displaying the search results in a web page in your site, you need a script that will perform the search and display the results in a table, separated in pages if they are too many to display in a single page

mwalsh62
11-07-2007, 03:22 PM
Hi Naval,

As to part one of your response, I had thought of user input, allowing them to add to the database, but as a secondary, "down the road" addition, once I had established a search.

The search I am attempting would be a feature on my site, for viewers, to find locations based on their input to name, city, state, etc. fields. As to how the results will be displayed, I haven't quite thought that through yet, still figuring out where and how results will be generated. I have read up a bit on SQL, haven't had as much exposure to PHP, am trying to fit in as much study as time will allow.

Your assistance is much appreciated,

navaldesign
11-07-2007, 03:50 PM
I believe that you should first start from the input part. The input can be EITHER from the users directly or even from YOU, using the same form.

When you are ready with that part, i can provide some instructions on how the search part can be built.

mwalsh62
11-08-2007, 03:36 AM
That idea is so crazy, it just may work!!!

Just kidding, that makes perfect sense. I've seen a lot of posts about ABVFP, is that where I should start? Not going to wait for an answer, the game is afoot!

Thanks again,

navaldesign
11-08-2007, 05:55 AM
Oh yes, it DOES work. This is the normal procedure. Although in my commercial scripts i don't use ABVFP because i need more specific functions, the concept is the same, there is a form, there is a script that processes the form, storing the info in the database, and at last there is a script that retrieves the info from the database according to certain criteria and displayes it (or prints it, or stores it in a file, or anything).

mwalsh62
11-08-2007, 06:39 AM
Hey Naval,

I've downloaded, set-up, and registered. I'm almost done building form, then I got stupid. I'm not sure I remember my form number! I recall that by default it was named "2"? Though in the name field I believe I had typed "1". I don't see it in confirmation e-mail, how can I retrieve to make certain so I may save form?

mwalsh62
11-08-2007, 06:50 AM
Hey,

I now see it in phpMyAdmin, just to make certain:

"One last but most important step: You need to add a hidden field in your form. This hidden field must be named “Formid” and its value must be the form number that ABVFP has indicated to you when you set up the form."

The hidden field value must be = "Formid" or "Formname"? And did I screw up by having them different? And does it matter what I name the form page itself for publishing?

mwalsh62
11-08-2007, 08:42 AM
Hi again!

I decided to be "ballsy", put my logical hat on, and went for it. It seems to have worked! The only problem I see is in the record in phpMyAdmin, the phone number is not number I submitted. I received the submission e-mail, and the phone number is right???

When I first submitted, I received error that phone number could be numbers only (xxxxxxxxxx vs. xxx-xxx-xxxx), I re-entered and it accepted. I have field named "Phone-NR", does it need to be "Telephone-NR" as spelled out in tutorial?

Thank you for the help and inspiration!

navaldesign
11-08-2007, 08:43 PM
No. ABVFP will create the database table fields after taking out the extension. The "Phone-NR" field will create a "Phone" field in the database.

As for the fact that you did not recieve the phone number in the database, it seems rather improbable to me, especially if it has sent you the email. The only logical explanation would be if you, first created a form WITHOUT the "Phone" field (or you had it named something else) and the you added this field (or named it something else). You see, ABVFP will create the table the VERY FIRST TIME you submit, after that, any field additions or renaming will be ignored. If this is the case, DELETE the form_nr2 table from the database, and then submit again so the table will be created again correctly.

mwalsh62
11-08-2007, 10:48 PM
Hi Naval,

I am 100% certain the table was created properly. No fields added after first submission. All fields filled in for first submission.

The odd thing is that the "wrong" number that appeared in the "Phone" field for each submission was "4294967295", which is the maximum value for "Int" according to SQL documentation.

I took a chance, and changed the type to "varchar" and it now works. Does this have any detrimental effects on the field, or the table as a whole?

navaldesign
11-09-2007, 05:20 AM
No problem at all.

mwalsh62
11-09-2007, 05:22 AM
Thanks Naval, I couldn't have done it without you!

Now, where do I find a script for a search?