Talk:Table countries

From Zen Cart(tm) Wiki
Jump to: navigation, search

dwno...could you extract the rest of this table with your handy dandy script?

--APurpleMonkey.com 09:14, 16 December 2005 (MST)

Done. Took me 2 minutes. Here's what I used for this:

<pre>
<?php

$table = 'countries';

$column_replace_array = array(
);


define('DB_SERVER', 'localhost');
define('DB_SERVER_USERNAME', '');
define('DB_SERVER_PASSWORD', '');
define('DB_DATABASE', '');

mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
mysql_select_db(DB_DATABASE);

$result = mysql_query('SELECT * FROM ' . $table);
$output = '';

while ($row = mysql_fetch_assoc($result))
{
	$separator = '';
$output .= '<BLOCKQUOTE>
{| 
';
foreach ($row as $key => $val)
{
	$output .= $separator;
	if (array_key_exists($key, $column_replace_array))
	{
		$val = $column_replace_array[$key];
	}
	elseif ($val === null)
	{
		$val = "''NULL''";
	}
	$output .= "|  [[Table $table#$key|$key]]: || $val\n";
	$separator = "|- \n";
}
$output .= '|}
</BLOCKQUOTE>


';
}

$output = str_replace($time_db_created, $time_replacement_text, $output);

echo htmlentities($output);
?>
</pre>

In other words, the only thing I actually changed was this part:

$table = 'countries';

$column_replace_array = array(
);

See a pattern then? :-)

For easy reference, here's the other one.

It actually took longer time to write this page than to get the data for the article. :-D

--Dwno 15:15, 16 December 2005 (MST)


I was just being lazy and thought I would draw on your expertise. Thanks a bunch! I might even take a crack at the next one myself (or I might sucker you into doing it again). :-P

--APurpleMonkey.com 17:37, 16 December 2005 (MST)