how to connect mysql databse into html and must display the rows and columns
of the database to html template

<HTML>
<HEAD>

<TITLE> LAB 229 </TITLE>
</HEAD>

<body bgcolor="#F54D70" link="#000000" alink="#000066" vlink="#000099">
<BR>
 
<B>     DSB Hotspot ratios : </B>
<!-- Coding for creating scroll bar to ratios  -->


<SELECT NAME="ratios" onChange="disp_text()">

<OPTION> >=3
<OPTION VALUE="5" SELECTED> >=5
<OPTION VALUE="10"> >=10
<OPTION VALUE="20"> >=20
<OPTION VALUE="30"> >=30
<OPTION VALUE="40"> >=40
<OPTION VALUE="50"> >=50
<OPTION VALUE="60"> >=60
<OPTION VALUE="70"> >=70

</SELECT>



<BR>
<BR>

<B>Upstream/ Downstream Size : </B>

<SELECT NAME="streams">
<OPTION SELECTED> 100
<OPTION> 500
<OPTION> 1000
<OPTION> 2000
<OPTION> 3000
<OPTION > 4000
</SELECT>
 

</BODY>
</HTML>

<H4>List of details in Table format:</H4>  



</BODY>
</HTML>



<?php

getDatabaseConnection();
FetchDataFromDatabase();


//Codings for connecting with the database
//****************************************
function getDatabaseConnection()
{
	
mysql_connect("hostname","username","password") or die("could not connected".mysql_error());
	mysql_select_db("database name") or die(mysql_error());
        //echo "Database connected successfully";
}



//TAKING OUT THE DATA FROM THE DATABASE
//**************************************
function FetchDataFromDatabase()
{
	?>


	<TABLE BORDER="5" BORDERCOLOR="BLACK">
	<TR>
	  <TH>Name</TH>
	  <TH>DSB </TH>
	  <TH> Count of reads</TH>
	  <TH>RGB </TH>
	</TR>

	<?php
	$i=0; 
	//and (a.position >= b.start-100 and a.position <= b.end+100)and a.ratio >=3 group by b.name");


	//$result3=mysql_query("select * from dsb_site_3 a,count_reads_sno b where a.xsome = b.xsome");
	$result3=("select * from dsb_site a, count_reads b 
                                     where a.xsome = b.xsome and (a.position >= b.start-100 and a.position <= b.end+100) 
			and a.ratio >=3 order by b.name");


	  while($row3 = mysql_fetch_array($result3, MYSQL_BOTH)) 
	  {
	
            $pos=$row3["position"];
		 //echo "---".$pos;
          //  $total_count=getNumberOfRatioRange($pos);        
        }// end while
      
	 //echo "DSB count ".$total_count;
 

	$result1= mysql_query("SELECT count,name from count_reads_sno")or die(mysql_error());
	
	while($row = mysql_fetch_array($result1, MYSQL_BOTH)) 
	{
		$count=$row["count"];
		$gene_name=$row["name"];
		
		echo "<TR>";
        	  echo "<TD WIDTH='200'ALIGN='LEFT'>$gene_name</TD>";
		  echo "<TD WIDTH='200'>ROW</TD>";
		  echo "<TD WIDTH='200' ALIGN='CENTER'>$count</TD>";
		  echo "<TD WIDTH='200'>COLOR</TD>";
		echo "</TR>";
	
	   	                 
	 }			
	

	echo "<TABLE>";

}

?>

uhmm is this right one ^^ ?

thread closed

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.