Sunday, May 25, 2008

Hi.

I m going to build a high scale site in php/mysql that needs to scale horizontally.

What things should the developer do and not do when writing the code and creating the database?

Thanks.

I want to make a blog and I should want to add a comment box too. What I can do. I know how can I create a form. I know to crate databases and tables. but I don t know how can we store comments. Do I want to create 1 column for 1 comment? Then If there 10 comments I want to create 10 columns. but that is not possible because i want to create 1 form for 1 comment. Then where can I store the comments. Please give the answer..please....

This might be a little difficult to explain but I ll try.

In MySQL I have a table like so:
id INT(3) PRIMARY KEY NOT NULL AUTO_INCREMENT-
name VARCHAR(255)-
code VARCHAR(255)-
subclass_id INT(3) NOT NULL DEFAULT=-1

So I have a bunch of records in my table like so
1- "UK"- "UK"- -1
2- "England"- "EN"- 1
3- "Wales"- "WA"- 1
4- "Scotland"- "SC"- 1
5- "ASIA"- "AS"- -1
6- "India"- "IN"- 5
7- "China"- "CN"- 5
8- "Pakistan"- "PK"- 5
9- "Afghanistan"- "AF"- 5
10- "Northern Ireland"- "NI"- 1
.. etc ..

OK- so you may have figured out how it works - the Top level categories which are like continents/kingdoms are denoted by -1 in the subclass_id meaning they are not subclassed. But countries within the continents are subclassed by the id of the continent they come from - e.g. India is in Asia (5).

Now my question is- how do I write one SQL command that will show the top level continents with the countries in them in an ordered list like so:
Continent
Country
Country
...
Continent
Country
...

how can i make a log in sytem on my website- Any easy ways. Or do i have to learn asp/mysql stuff?

What is the difference between mysql_fetch_object and mysql fetch_array ?

In how many ways we can retrieve the date in the result set of MYSQL using PHP ?

No comments: