php database...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Alidad
Forum Commoner
Posts: 29
Joined: Thu Mar 29, 2007 12:42 pm

php database...

Post by Alidad »

hi, I know this is sound crazy but I'm still rookie try to undersand how to write that php code.

I have signup form and one of text fields relate to country, the country is comes with code number. So let say I have two database tables which is called "country" and "country_code" in table name "country_code" has two columns which is list of countries and list of code number.

See sample columns

Country_code table...

country code
---------- ------
usa 253
canada 259
Demark 521

So when person select country it will retreive code number that are match with country name and then insert country code into the country database.

does any one help me how can i write that code !

please thanks.

AM
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: php database...

Post by flying_circus »

What you're trying to do is relatively straight forward, but there are many ways to do it. What have you tried so far? Have you started writing any code, and can you share it?

When the form is submitted, one of the post variables will be the country. Based on the value of the country you would run a database SELECT query to get the country code. Next, you would run a database INSERT query to insert the country code into your other table.

I question your database design, but we all have to start somewhere :)

Show us what you've got an we'll see if we cant help connect the dots.
Alidad
Forum Commoner
Posts: 29
Joined: Thu Mar 29, 2007 12:42 pm

Re: php database...

Post by Alidad »

No i have not write any code because i do not understand how to reterive that from other database.

do you have any sample site where i can learn more about those!

AM
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: php database...

Post by flying_circus »

Alidad wrote:No i have not write any code because i do not understand how to reterive that from other database.

do you have any sample site where i can learn more about those!

AM
Sure, try w3schools

http://www.w3schools.com/PHP/php_mysql_intro.asp
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: php database...

Post by McInfo »

User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: php database...

Post by flying_circus »

McInfo wrote:Re: W3Schools
Haha, hadnt seen that before :mrgreen:

I guess that's the last plug they get from me.
Post Reply