Home About Portfolio Links Contact

Create states and countries

I found a few lists of states and countries but not really anything for setting up a database so I thought i would make my own.

 

| More
Share with friends and family

 

Open Connection and Create Database.

 

List of Countries.

 

List of states.

 

Insert and Display.

// OH NOEZ ITS BUSH!
$GWBush = explode(",", $countries);
$GWBush_state = explode(",", $states);
?>
<table width="500" border="0" cellpadding="0" cellspacing="0">
<?php
//Start from 1
$i = 1;
foreach($GWBush as $ce){

//Countries & States
$query = mysql_query("INSERT INTO que_countries VALUES('{$i}', '{$ce}' )");
?>
<tr>
<td width="59" align="right"><div style="padding:4px;"><?= $i ?>. )</div></td>
<td width="441" align="left"><div style="padding:4px;"><?= $ce ?>&nbsp;&nbsp;<?php
if (!$query) {
echo '<span style="font-weight:bold; color:#FF0000;">( Failed )';
}
else {
echo '<span style="font-weight:bold; color:#00FF00;">( GTG! )';
}
?></span></div></td>
</tr>
<?php $i++;
}
?>
</table>
<table width="500" border="0" cellpadding="0" cellspacing="0">
<?php
// Start from 1
$i = 1;
foreach($GWBush_state as $ce){

// Countries & States
$query = mysql_query("INSERT INTO que_states VALUES('{$i}', '{$ce}' )");
?>
<tr>
<td width="59" align="right"><div style="padding:4px;"><?= $i ?>. )</div></td>
<td width="441" align="left"><div style="padding:4px;"><?= $ce ?>&nbsp;&nbsp;<?php
if (!$query) {
echo '<span style="font-weight:bold; color:#FF0000;">( Failed )';
}
else {
echo '<span style="font-weight:bold; color:#00FF00;">( GTG! )';
}
?></span></div></td>
</tr>
<?php $i++;
}
?>
</table>

 

If you would like to add to this code to make it better feel free to contact me with what you would like to add.

To view all click here

 

| More
Comments
testSumited: 05/18/2010
test
Add Comment