473,385 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Creating matrix summary report

Hello

I need some help redisplaying and formatting data from a MySQl DB. So far
using PHP, I have the (partial for this example) data list:

Sample_ID Marker_ID Variation

G23_NA17192.fsa rs7374540 A/C

I23_Control.fsa rs7374540 C/C

C03_NA17110.fsa rs7428779 C/C

E21_NA17183.fsa rs6788899 G/G

K15_NA17162.fsa rs6599223 C/C

M15_NA17163.fsa rs6599223 C/C

M15_NA17163.fsa rs312451 A/C

What I would like to do is create a matrix/summary like this:

Marker_ID

Sample_ID rs7374540 rs7428779 rs6788899 rs6599223 rs31245

G23_NA17192.fsa A/C

I23_Control.fsa C/C

C03_NA17110.fsa C/C

E21_NA17183.fsa G/G

K15_NA17162.fsa C/C

M15_NA17163.fsa C/C A/C

Thus far my code looks like this:

<?php

// DB specific info
DEFINE (DB_USER, "mysql");
DEFINE (DB_PASSWORD, "vil43nrt");
DEFINE (DB_HOST, "localhost");
DEFINE (DB_NAME, "snplexdb_prototype");

//Connect to MySQL

$db_connection = (mysql_connect (DB_HOST, DB_USER, DB_PASSWORD));

//Select DB

mysql_select_db (DB_NAME);

$sql_query1 = "SELECT sample_id,snpidxref,var FROM sampleresults";

$sql_result1 = mysql_query($sql_query1, $db_connection);

$no_of_rows = mysql_num_rows($sql_result1);
echo $no_of_rows;
echo "</br>";

while ($results_array = mysql_fetch_array($sql_result1)) {

echo "<tr><td>";
echo $results_array["sample_id"];
echo " ";
echo "</td><td>";
echo $results_array["snpidxref"];
echo " ";
echo "</td><td>";
echo $results_array["var"];
echo "</td></tr>\n";
echo "</br>";

}
echo "</table>";
mysql_close($db_connection);
?>

My guess is that I need to suck the above list into a different array but
I'm not sure how to progress past the following:

To get unique Ids

$id_query= "SELECT DISTINCT sample_id FROM sampleresults";
$id_result= mysql_query($id_query, $db_connection);
$snp_query= "SELECT DISTINCT snpidxref FROM sampleresults";
$snp_result = mysql_query($snp_query, $db_connection);

I then presume I have to run a WHILE or FOREACH loop but just as how to
construct it, I am at at total loss.

Thanks

Charles
--

Jul 17 '05 #1
0 1283

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wayfarer | last post by:
I've built a report using a aggregate query that is grouped by Month + Year, Program and Name. When I feed the date ranges as query parameters, it will very properly print out a report that shows...
4
by: tshad | last post by:
I am trying to set up an Image authorization where you type in the value that is in a picture to log on to our site. I found a program that is supposed to do it, but it doesn't seem to work. ...
1
by: jessicaeatworld | last post by:
Hi, I am using Access 2003 and need a report to show details and then a summary at the bottom that separates by market. I see that I could group, then put a summary after each group but I need the...
14
by: Thomas Bauer | last post by:
Hello, I search a example like that. (1,0,0,1,4,5 ) -- moving (1,0,0,1,0,0 ) -- normal matrix (-1,0,0,1,0,0 ) -- Mirror Y-Axis (0,-1,0,1,0,0 ) -- Mirror X-Axis I caluculate all in mm.
1
by: cgiscri | last post by:
Hello, I need to create a report summary that displays data from 8 individual reports. The control source for each individual report is a distinct query. I am currently using an unbound report...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.