Page 1 of 1

php database...

Posted: Sat Jul 02, 2011 1:43 pm
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

Re: php database...

Posted: Sat Jul 02, 2011 3:22 pm
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.

Re: php database...

Posted: Sat Jul 02, 2011 3:38 pm
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

Re: php database...

Posted: Sat Jul 02, 2011 5:00 pm
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

Re: php database...

Posted: Sat Jul 02, 2011 5:47 pm
by McInfo

Re: php database...

Posted: Sat Jul 02, 2011 8:34 pm
by flying_circus
McInfo wrote:Re: W3Schools
Haha, hadnt seen that before :mrgreen:

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