473,516 Members | 3,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

advantages of php

hi all,

i have to create a spelling and a picture game where words will be stored in
database. for the spelling game, the word wil be splited in two parts.in the
database the will be two columns the first syllabe and the ending syllabe
column. i was wondering what type except of type varchar should be. should
be primary or foreign key? i have decided to use php for that game as i am
familar with. is this the best language for that system?

Thanks

Jul 17 '05 #1
3 1858
Goofy wrote:
hi all,

i have to create a spelling and a picture game where words will be stored
in database. for the spelling game, the word wil be splited in two
parts.in the database the will be two columns the first syllabe and the
ending syllabe column. i was wondering what type except of type varchar
should be. should be primary or foreign key? i have decided to use php for
that game as i am familar with. is this the best language for that system?

Thanks


Hi Goofy,

Forgive me for being blunt, but your question gave me the impression you
need to learn some (SQL)basics first.
Try this for a SQL-primer (and learn about foreign keys, primary keys,
datatypes, etc):
http://www.w3schools.com
You will find in the left frame both a SQL and a PHP primer.

Be sure to to the SQL-lessons, they are really set up right and you will
learn the basics in just 1 day.
(I do not know if you need the PHP primer, up to you.)

Foreign keys are used to ensure database integrity and are used when you
reference a value from another table (often the Primary Key).
(In my humble opinion they should ALWAYS be used in that situation.)

As for the datatype (varchar), that depends on the database you will use.
Not all databases have the same datatypes.
In general: varchar is a good choice because the length is variable.
Only drawback is that it uses 16 bytes (in most cases I saw) to just store
nothing. 17 for 1 char, 18 for 2 chars, etc.
The reason is varchar uses 2 pointers to point to the beginning and the end
of the string, and (in most cases i saw) a pointer takes up 4 bytes.
So varchar can be a bit 'heavy' in certain cases, but do not worry about
that for now, just use it. :-)

Good luck Goofy, and drop back in here if you have questions.

Do you know which database you will use?

Regards,
Erwin Moller

Jul 17 '05 #2
Erwin Moller wrote:
In general: varchar is a good choice because the length is variable.
Only drawback is that it uses 16 bytes (in most cases I saw) to just store
nothing. 17 for 1 char, 18 for 2 chars, etc.
The reason is varchar uses 2 pointers to point to the beginning and the
end of the string, and (in most cases i saw) a pointer takes up 4 bytes.


As you can see I should go to w3schools too and do a basic
calculationscourse.
4bytes + 4bytes = 16 bytes?
Hmmm....

Jul 17 '05 #3

? "Erwin Moller"
<si******************************************@spam yourself.com> ?????? ???
?????? news:41***********************@news.xs4all.nl...
Goofy wrote:
hi all,

i have to create a spelling and a picture game where words will be stored in database. for the spelling game, the word wil be splited in two
parts.in the database the will be two columns the first syllabe and the
ending syllabe column. i was wondering what type except of type varchar
should be. should be primary or foreign key? i have decided to use php for that game as i am familar with. is this the best language for that system?
Thanks
Hi Goofy,

Forgive me for being blunt, but your question gave me the impression you
need to learn some (SQL)basics first.
Try this for a SQL-primer (and learn about foreign keys, primary keys,
datatypes, etc):
http://www.w3schools.com
You will find in the left frame both a SQL and a PHP primer.

Be sure to to the SQL-lessons, they are really set up right and you will
learn the basics in just 1 day.
(I do not know if you need the PHP primer, up to you.)

Foreign keys are used to ensure database integrity and are used when you
reference a value from another table (often the Primary Key).
(In my humble opinion they should ALWAYS be used in that situation.)

As for the datatype (varchar), that depends on the database you will use.
Not all databases have the same datatypes.
In general: varchar is a good choice because the length is variable.
Only drawback is that it uses 16 bytes (in most cases I saw) to just store
nothing. 17 for 1 char, 18 for 2 chars, etc.
The reason is varchar uses 2 pointers to point to the beginning and the

end of the string, and (in most cases i saw) a pointer takes up 4 bytes.
So varchar can be a bit 'heavy' in certain cases, but do not worry about
that for now, just use it. :-)

Good luck Goofy, and drop back in here if you have questions.

Do you know which database you will use?

Regards,
Erwin Moller

i will use mysql database
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
7392
by: bissatch | last post by:
Hi, Generally if I re-use code, I use a function. If I need to use these functions over a number of pages I write the function to an include file where all pages have access. So when should I ever use PHP classes instead. I have learned how to put together PHP classes but never seen a reason to use them where I can simply use a function.
65
6665
by: Anthony_Barker | last post by:
I have been reading a book about the evolution of the Basic programming language. The author states that Basic - particularly Microsoft's version is full of compromises which crept in along the language's 30+ year evolution. What to you think python largest compromises are? The three that come to my mind are significant whitespace,...
17
7808
by: Kamil Burzynski | last post by:
Hello. I have to create short (1 hour) presentation about C++ advantages over C. Are there any good articles/texts/etc. about such topic? Personally, I'm quite proficient at C++ myself (e.g. I've read and understood many books from H. Sutter, A. Alexandrescu etc.), so I do not need to learn about C++ before making that presentation. I am...
2
3433
by: Mark | last post by:
Hi all, a quick ADO.NET question in regards to the command object. What are the advantages (if any) of specifying command parameters when executing a stored procedure over just calling the stored procedure via dynamic SQL? // Pseudo code below using dynamic SQL private void InsertPerson(string sName) { SqlCommand myCommand = new...
1
3923
by: Husam | last post by:
Hi EveryBody: I have research about advantages and disadvantages of C++ languages In one of my programming courses. Can Any one help me and told me about advantages and disadvantages of C++ or redirect me to some web sites proffessinal about this kind of reserach ? any help will be appreciated
11
1728
by: Bob Rosen | last post by:
I have used VB.NET for several months. Just recently I was asked to modify some web pages that were developed with C#. Although I know that C# is much more popular, in comparing the two all of the advantages that I have come across so far lie on the VB side (correct me if I'm wrong about any of these; I'm still relatively new to C#): 1....
1
9149
by: vumani | last post by:
what is the advantages and disadvantages of Ms SQL server and java servletts front-end on the clien end. what is the advantages and disadvantages of Ms Access on the server, connected via JDBC and java on the client end. what is the advantages and disadvantages of HTML on the client end,coupled with SQL server and ODBL on the server end.
1
3461
by: bantunks | last post by:
Hello, I am trying to figure out the advantages and disadvantages of exposing interfaces through Opaque data types in C. I have figured/found out the following two advantages 1. Higher level of abstraction 2. if the layout of the defined structure inside the source files changes, it will reduce/limit/minimize the amount of changes that may...
0
7273
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7405
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7574
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
4769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3252
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1620
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.