Difference between revisions of "Genesetdb"

From Pathology Education Instructional Resource
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<syntaxhighlight lang="php">
+
<syntaxhighlight lang="php" enclose="div">
<?php
 
$con= mysqli_connect("localhost", "jrsinger", "U6d19lrBFC48z2fpF1K5PcRy80XS17QC", "genesetdb");
 
if(mysqli_connect_errno())
 
{
 
die( "could not connect: " . mysqli_connect_error());
 
}
 
echo'
 
 
<html>
 
<html>
 
   <head>
 
   <head>
     <title>genetable</title>
+
     <title>genetable for the ooga</title>
 
   </head>
 
   </head>
 
   <body>
 
   <body>
Line 18: Line 11:
 
         <th>Gene ID</th>
 
         <th>Gene ID</th>
 
       </tr>
 
       </tr>
    ';
+
<?php
$sql="SELECT * FROM `workaround`;";
+
$con= mysqli_connect("localhost", "ooga", "booga","genesetdb");
$result= mysqli_query($con,$sql);
+
if(mysqli_connect_errno())
$pid=1;
 
$genes=0;
 
while ($row=mysqli_fetch_array($result))
 
 
{
 
{
for($i=0; $i<200; $i++)
+
    die( "could not connect: " . mysqli_connect_error());
{
+
}
mysqli_query($con,"INSERT INTO TABLE `finalgeneset` VALUES(BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY" . $pid . ",". $row[$genes] . ");");
+
// Get absolute count of rows in table "genesets"; export
echo '
+
// that count into a variable called $pidcount
 +
$sql = "SELECT COUNT(*) AS cnt FROM `genesets`;";
 +
$result = mysqli_query($con, $sql);
 +
$row = mysqli_fetch_array($result);
 +
$pidcount = $row['cnt'];
 +
/*
 +
Now get the entirety of genesets and CHOWN THE HELL OUT OF IT!
 +
Where "CHOWNing" in this case means the generation of a table
 +
that looks roughly like:
 +
pid    geneid
 +
---    ------
 +
1      $row[3]
 +
1      $row[4]
 +
1      $row[5]
 +
...
 +
1      $row[203]
 +
2      $row[3]
 +
...
 +
*/
 +
$sql = "SELECT * FROM `genesets`;";
 +
$result = mysqli_query($con, $sql);
 +
while($row = mysqli_fetch_array($result))
 +
{
 +
    for($i = 3; $i<204; $i++)
 +
    {
 +
        $booga = "INSERT INTO finalgeneset(exp,geneid) VALUES(" . $row[0] . "," . $row[$i] . ");";
 +
        $ooga = mysqli_query($con, $booga);
 +
        echo '
 
       <tr>
 
       <tr>
         <td>' . $pid . '</td>
+
         <td>' . $row[0] . '</td>
         <td>' . $row[$genes] . '</td>
+
         <td>' . $row[$i] . '</td>
 
       </tr>
 
       </tr>
';
+
        ';
$genes++;
+
    }
}
 
$pid++;
 
$genes = 0;
 
 
}
 
}
echo'
+
?>
 
     </table>
 
     </table>
 
   </body>
 
   </body>
 
</html>
 
</html>
';
+
</syntaxhighlight>
?>
+
 
</syntaxhighltight>
+
 
 +
{{This Is Your Brain On Informatics}}
 +
 
 +
[[Category:This Is Your Brain On Informatics]]

Latest revision as of 02:40, 19 March 2014

<html>
  <head>
    <title>genetable for the ooga</title>
  </head>
  <body>
    <h1> Genetable</h1>
    <table border="1">
      <tr>
        <th>Experiment Number</th>
        <th>Gene ID</th>
      </tr>
<?php
$con= mysqli_connect("localhost", "ooga", "booga","genesetdb");
if(mysqli_connect_errno())
{
    die( "could not connect: " . mysqli_connect_error());
}
// Get absolute count of rows in table "genesets"; export
// that count into a variable called $pidcount
$sql = "SELECT COUNT(*) AS cnt FROM `genesets`;";
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result);
$pidcount = $row['cnt'];
/* 
Now get the entirety of genesets and CHOWN THE HELL OUT OF IT!
Where "CHOWNing" in this case means the generation of a table
that looks roughly like:
pid    geneid
---    ------
1      $row[3]
1      $row[4]
1      $row[5]
...
1      $row[203]
2      $row[3]
...
*/
$sql = "SELECT * FROM `genesets`;";
$result = mysqli_query($con, $sql);
while($row = mysqli_fetch_array($result))
{
    for($i = 3; $i<204; $i++)
    {
        $booga = "INSERT INTO finalgeneset(exp,geneid) VALUES(" . $row[0] . "," . $row[$i] . ");";
        $ooga = mysqli_query($con, $booga);
        echo '
      <tr>
        <td>' . $row[0] . '</td>
        <td>' . $row[$i] . '</td>
      </tr>
        ';
    }
}
?>
    </table>
  </body>
</html>