English 中文(简体)
垂直显示单薄片,用于比较或印刷目的[复制]
原标题:displaying a mysql table vertically - for comparison or for print out purposes [duplicate]
  • 时间:2012-05-11 05:55:20
  •  标签:
  • php
  • mysql

你们的表象

seed_id     name           country
-------     ----------     -------

1           John           America
2           Jose           Mexico
3           Khan           Pakistan

并且,你希望将《防止母婴传播公约》纵向描述如下;

seed_id     1             2           3
name        John          Jose        Khan
country     America       Mexico      Pakistan

这种观点在两种情况下都很简单。

你们想要印刷表格,或想对田地进行一面比较。

从印刷角度讲,在一份有50个领域的表格上,甚至印刷一个单一记录观点,也使你无法阅读。 该文件将在第10个领域以印刷方式予以删除。

但是,从纵向角度看,这并不是表格中有多少领域。

同样,当你对记录进行旁边比较时,就象在这个美丽的例子中那样。

http://www.dpreview.com/products/compare/side-by-side?products=nikon_d90&products=nikon_d3&products=nikon_d4&sortDir=ascending

你非常有益。

I can sit down write this library function now but don t have the time at this moment. But I m sure someone out there has either the time for it, or already has written it. Would you please share it please?

概览(dbh,“从1=1的表X中选取”);

问题回答

这种做法可能更好......

$table = array();
foreach($result_row as $row)
{
  foreach(array( seed_id , name , country ) as $index)
  {
    $table[$index][] = $row[$index];
  }
}

象这样,应该重新组织你们的阵列,使其融入所需要的结构。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签